lib/intermodal/concerns/models/resource_linking.rb
# .append
#  - adds new resources into the list
#  - does not add redundent resources
.append
adds new resources into the list
does not add redundent resources
. append adds new resources into the list does not add redundent resources
def append(parent_id, resource_ids, options = {})
          transaction do
            parent = parent_model.get(parent_id, options.except(:parent, :parent_id))
            return nil unless parent
            resource_ids = resource_ids - by_parent_id(parent_id).by_target_id(resource_ids).to_target_ids
            parent.send("#{target_resource_name.to_s.pluralize}") << target_model.get(:all, options).where(:id => resource_ids)
          end
        end
def append ( parent_id , resource_ids , options = { } ) transaction do parent = parent_model . get ( parent_id , options . except ( :parent , :parent_id ) ) return nil unless parent resource_ids = resource_ids - by_parent_id ( parent_id ) . by_target_id ( resource_ids ) . to_target_ids parent . send ( "#{target_resource_name.to_s.pluralize}" ) << target_model . get ( :all , options ) . where ( :id => resource_ids ) end end
.append
 adds new resources into the list
 does not add redundent resources
. append adds new resources into the list does not add redundent resources
parent_id
resource_ids
options