Module: Submission::AssetGroupBehaviour

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

Overview

rubocop:todo Style/Documentation

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

Instance Method Details

#complete_building_asset_groupObject


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

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