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

#savePrime::Model

Saves model and all associations to store.

Returns:

  • (Prime::Model)

    model



12
13
14
15
16
17
18
19
20
21
22
# File 'motion-prime/models/_association_mixin.rb', line 12

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