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.


181
182
183
184
185
186
187
188
189
# File 'lib/sequel/plugins/association_pks.rb', line 181

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.


192
193
194
195
# File 'lib/sequel/plugins/association_pks.rb', line 192

def refresh
  @_association_pks = nil
  super
end