module Sequel::Plugins::DelayAddAssociation::InstanceMethods

Private Instance Methods

add_associated_object(opts, o, *args) click to toggle source

Delay the addition of the associated object till after saving the current object, if the current object is new and the associated dataset requires a primary key on the current object.

Calls superclass method
# File lib/sequel/plugins/delay_add_association.rb, line 39
def add_associated_object(opts, o, *args)
  if opts.dataset_need_primary_key? && new?
    o = make_add_associated_object(opts, o)
    delay_validate_associated_object(opts, o)
    send(opts[:name]) << o
    after_create_hook{super(opts, o, *args)}
    o
  else
    super
  end
end