Module: Submission::AssetGroupBehaviour

Included in:
Order
Defined in:
app/models/submission/asset_group_behaviour.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object


2
3
4
5
6
7
8
9
10
11
# File 'app/models/submission/asset_group_behaviour.rb', line 2

def self.included(base)
  base.class_eval do
    belongs_to    :asset_group
    before_create :find_asset_group,             unless: :asset_group?
    before_create :pull_assets_from_asset_group, if: :asset_group?

    # Required once out of the building state ...
    validates_presence_of :assets, if: :assets_need_validating?
  end
end

Instance Method Details

#complete_buildingObject


20
21
22
23
# File 'app/models/submission/asset_group_behaviour.rb', line 20

def complete_building
  create_our_asset_group unless asset_group? or assets.blank?
  super
end