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.



188
189
190
191
192
193
194
195
196
# File 'lib/sequel/plugins/association_pks.rb', line 188

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

#refreshObject

Clear the associated pks if explicitly refreshing.



199
200
201
202
# File 'lib/sequel/plugins/association_pks.rb', line 199

def refresh
  @_association_pks = nil
  super
end