Module: Sequel::Plugins::AssociationPks::InstanceMethods

Defined in:
lib/sequel/plugins/association_pks.rb

Instance Method Summary collapse

Instance Method Details

#after_saveObject

After creating an object, if there are any saved association pks, call the related association pks setters.



219
220
221
222
223
224
225
226
227
228
# File 'lib/sequel/plugins/association_pks.rb', line 219

def after_save
  if assoc_pks = @_association_pks
    assoc_pks.each do |name, pks|
     # pks_setter_method is private
      send(model.association_reflection(name)[:pks_setter_method], pks)
    end
    @_association_pks = nil
  end
  super
end

#refreshObject

Clear the associated pks if explicitly refreshing.



231
232
233
234
# File 'lib/sequel/plugins/association_pks.rb', line 231

def refresh
  @_association_pks = nil
  super
end