Module: Sequel::Plugins::AssociationPks::InstanceMethods
- Defined in:
- lib/sequel/plugins/association_pks.rb
Instance Method Summary collapse
-
#after_save ⇒ Object
After creating an object, if there are any saved association pks, call the related association pks setters.
-
#refresh ⇒ Object
Clear the associated pks if explicitly refreshing.
Instance Method Details
#after_save ⇒ Object
After creating an object, if there are any saved association pks, call the related association pks setters.
147 148 149 150 151 152 153 154 155 |
# File 'lib/sequel/plugins/association_pks.rb', line 147 def after_save if assoc_pks = @_association_pks assoc_pks.each do |name, pks| instance_exec(pks, &model.association_reflection(name)[:pks_setter]) unless pks.empty? end @_association_pks = nil end super end |
#refresh ⇒ Object
Clear the associated pks if explicitly refreshing.
158 159 160 161 |
# File 'lib/sequel/plugins/association_pks.rb', line 158 def refresh @_association_pks = nil super end |