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
39 def add_associated_object(opts, o, *args)
40   if opts.dataset_need_primary_key? && new?
41     o = make_add_associated_object(opts, o)
42     delay_validate_associated_object(opts, o)
43     public_send(opts[:name]) << o
44     after_create_hook{super(opts, o, *args)}
45     o
46   else
47     super
48   end
49 end