module Sequel::Plugins::AssociationPks::InstanceMethods

Public Instance Methods

after_save() click to toggle source

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

# File lib/sequel/plugins/association_pks.rb, line 161
def after_save
  if assoc_pks = @_association_pks
    assoc_pks.each do |name, pks|
      instance_exec(pks, &model.association_reflection(name)[:pks_setter])
    end
    @_association_pks = nil
  end
  super
end
refresh() click to toggle source

Clear the associated pks if explicitly refreshing.

# File lib/sequel/plugins/association_pks.rb, line 172
def refresh
  @_association_pks = nil
  super
end