scinote-web/app/models/result_asset.rb

11 lines
275 B
Ruby
Raw Normal View History

2016-02-12 23:52:43 +08:00
class ResultAsset < ActiveRecord::Base
validates :result, :asset, presence: true
belongs_to :result, inverse_of: :result_asset
belongs_to :asset, inverse_of: :result_asset, dependent: :destroy
2016-02-12 23:52:43 +08:00
def space_taken
asset.present? ? asset.estimated_size : 0
end
2016-02-12 23:52:43 +08:00
end