mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-18 07:01:58 +08:00
13 lines
345 B
Ruby
13 lines
345 B
Ruby
class ResultAsset < ApplicationRecord
|
|
validates :result, :asset, presence: true
|
|
|
|
belongs_to :result, inverse_of: :result_asset, optional: true
|
|
belongs_to :asset,
|
|
inverse_of: :result_asset,
|
|
dependent: :destroy,
|
|
optional: true
|
|
|
|
def space_taken
|
|
asset.present? ? asset.estimated_size : 0
|
|
end
|
|
end
|