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
- #_bags ⇒ Object
- #bag_key_for(bag_name) ⇒ Object
-
#save ⇒ Prime::Model
Saves model and all associations to store.
Instance Method Details
#_bags ⇒ Object
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 |
#save ⇒ Prime::Model
Saves model and all associations to store.
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 |