def associate!(target,opts={})
    targets = Array.wrap(target)
    targets.each do |t|
      association = @associations.find!(t)
      response = self.class.session.connection.set_relationship(
        self.class._module.name, self.id, 
        association.link_field, [t.id], opts
      )
      if response["failed"] > 0
        raise AssociationFailed, 
        "Couldn't associate #{self.class._module.name}: #{self.id} -> #{t}: #{t.id}!" 
      end
      # We need to update the association cache for any changes we make.
      if opts[:delete] == 1
        update_association_cache_for(association.link_field, t, :delete)
        t.update_association_cache_for(association.link_field, self, :delete)
      else
        update_association_cache_for(association.link_field, t, :add)
        t.update_association_cache_for(t.associations.find!(self).link_field, self, :add)
      end
    end
    true
  end
def associate!(target,opts={})
    targets = Array.wrap(target)
    targets.each do |t|
      association = @associations.find!(t)
      response = self.class.session.connection.set_relationship(
        self.class._module.name, self.id, 
        association.link_field, [t.id], opts
      )
      if response["failed"] > 0
        raise AssociationFailed, 
        "Couldn't associate #{self.class._module.name}: #{self.id} -> #{t}: #{t.id}!" 
      end
      # We need to update the association cache for any changes we make.
      if opts[:delete] == 1
        update_association_cache_for(association.link_field, t, :delete)
        t.update_association_cache_for(association.link_field, self, :delete)
      else
        update_association_cache_for(association.link_field, t, :add)
        t.update_association_cache_for(t.associations.find!(self).link_field, self, :add)
      end
    end
    true
  end
Creates a relationship between the current object and the target object
 The current and target records will have a relationship set
 i.e. account.associate!(contact) would link account and contact
 In contrast to using account.contacts << contact, this method doesn't load the relationships
 before setting the new relationship.
 This method is useful when certain modules have many links to other modules: not loading the
 relationships allows one to avoid a Timeout::Error