lib/scaffolding_extensions/meta_model.rb
# Add the objects specified by associated_object_ids to the given object
# using the given association.  If the object to be associated with the given object is
# already associated with it, skip it (don't try to associate it multiple times).
# Returns the associated object (if only one id was given), or an array of objects
# (if multiple ids were given).
Add the objects specified by associated_object_ids to the given object
using the given association.  If the object to be associated with the given object is
already associated with it, skip it (don't try to associate it multiple times).
Returns the associated object (if only one id was given), or an array of objects
(if multiple ids were given).
Add the objects specified by associated_object_ids to the given object using the given association . If the object to be associated with the given object is already associated with it skip it ( don ' t try to associate it multiple times ) . Returns the associated object ( if only one id was given ) or an array of objects ( if multiple ids were given ) .
def scaffold_add_associated_objects(association, object, options, *associated_object_ids)
    unless associated_object_ids.empty?
      scaffold_transaction do
        associated_objects = associated_object_ids.map{|i| scaffold_association_find_object(association, i.to_i, :session=>options[:session])}
        associated_objects.each{|o| scaffold_add_associated_object(association, object, o)}
        associated_object_ids.length == 1 ? associated_objects.first : associated_objects
      end
    end
  end
def scaffold_add_associated_objects ( association , object , options , * associated_object_ids ) unless associated_object_ids . empty? scaffold_transaction do associated_objects = associated_object_ids . map { | i | scaffold_association_find_object ( association , i . to_i , :session => options [ :session ] ) } associated_objects . each { | o | scaffold_add_associated_object ( association , object , o ) } associated_object_ids . length == 1 ? associated_objects . first : associated_objects end end end
Add the objects specified by associated_object_ids to the given object
using the given association.
Add the objects specified by associated_object_ids to the given object using the given association .
association
<not_specific>
object
<not_specific>
options
<not_specific>
associated_object_ids
<not_specific>