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



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

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 :assets, presence: { if: :assets_need_validating? }
  end
end

Instance Method Details

#complete_building_asset_groupObject



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

def complete_building_asset_group
  create_our_asset_group unless asset_group? || assets.blank?
end