Module: MotionPrime::ModelAssociationMixin

Extended by:
MotionSupport::Concern
Included in:
Model
Defined in:
motion-prime/models/_association_mixin.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#_bagsObject



5
6
7
# File 'motion-prime/models/_association_mixin.rb', line 5

def _bags
  @_bags ||= {}
end

#bag_key_for(bag_name) ⇒ Object



9
10
11
# File 'motion-prime/models/_association_mixin.rb', line 9

def bag_key_for(bag_name)
  self.info[bag_name]
end

#savePrime::Model

Saves model and all associations to store.

Returns:

  • (Prime::Model)

    model



16
17
18
19
20
21
22
23
24
# File 'motion-prime/models/_association_mixin.rb', line 16

def save
  _bags.values.each do |bag|
    bag.store = self.store
    bag.save
  end
  super
rescue StoreError => e
  raise e if Prime.env.development?
end