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.



155
156
157
158
159
160
161
162
163
# File 'lib/sequel/plugins/association_pks.rb', line 155

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.



166
167
168
169
# File 'lib/sequel/plugins/association_pks.rb', line 166

def refresh
  @_association_pks = nil
  super
end