Class ActiveLdap::Association::BelongsToMany
In: lib/active_ldap/association/belongs_to_many.rb
Parent: Collection
Error DeleteError LdapError AdapterNotSpecified OperationNotPermitted RequiredAttributeMissed LdifInvalid AttributeAssignmentError RequiredObjectClassMissed DistinguishedNameNotSetError StrongAuthenticationRequired ConnectionError SaveError EntryNotFound AuthenticationError EntryNotSaved UnknownAttribute ConnectionNotEstablished TimeoutError ConfigurationError AdapterNotFound DistinguishedNameInvalid ObjectClassError EntryInvalid EntryAlreadyExist Base DistinguishedName Ldif Reloadable::Deprecated Reloadable::Subclasses Enumerable Collection StandardError Children HasMany HasManyWrap BelongsToMany Proxy BelongsTo Common Find LDIF Delete Update GetText Parser GetTextSupport Base\n[lib/active_ldap/adapter/base.rb\nlib/active_ldap/adapter/ldap.rb\nlib/active_ldap/adapter/net_ldap.rb] Ldap NetLdap Normalize ActiveRecord::Callbacks ActiveRecord::Validations Schema\n[lib/active_ldap/schema.rb\nlib/active_ldap/schema/syntaxes.rb] lib/active_ldap/base.rb lib/active_ldap/schema.rb lib/active_ldap/ldif.rb lib/active_ldap/distinguished_name.rb lib/active_ldap/ldap_error.rb ClassMethods Associations ClassMethods HumanReadable lib/active_ldap/association/has_many_wrap.rb lib/active_ldap/association/has_many.rb lib/active_ldap/association/proxy.rb lib/active_ldap/association/children.rb lib/active_ldap/association/collection.rb lib/active_ldap/association/belongs_to_many.rb lib/active_ldap/association/belongs_to.rb HasManyUtils Association ClassMethods Tree Acts Common LDIF Delete Find Update Operations lib/active_ldap/get_text/parser.rb GetText ClassMethods Configuration Command lib/active_ldap/adapter/net_ldap.rb lib/active_ldap/adapter/ldap.rb Adapter GetTextSupport Normalize ClassMethods Attributes Escape Callbacks ClassMethods ObjectClass Helper Validations ClassMethods Connection GetTextFallback Populate Salt UserPassword ActiveLdap dot/m_40_0.png

Methods

Private Instance methods

[Source]

    # File lib/active_ldap/association/belongs_to_many.rb, line 17
17:       def delete_entries(entries)
18:         entries.each do |entry|
19:           old_value = entry[@options[:many], true]
20:           new_value = old_value - @owner[@options[:foreign_key_name], true]
21:           new_value = new_value.uniq.sort
22:           if old_value != new_value
23:             entry[@options[:many]] = new_value
24:             entry.save
25:           end
26:         end
27:       end

[Source]

    # File lib/active_ldap/association/belongs_to_many.rb, line 29
29:       def find_target
30:         values = @owner[@options[:foreign_key_name], true].compact
31:         return [] if values.empty?
32: 
33:         key = @options[:many]
34:         components = values.collect do |value|
35:           [key, value]
36:         end
37:         options = find_options(:filter => [:or, *components])
38:         foreign_class.find(:all, options)
39:       end

[Source]

    # File lib/active_ldap/association/belongs_to_many.rb, line 7
 7:       def insert_entry(entry)
 8:         old_value = entry[@options[:many], true]
 9:         new_value = old_value + @owner[@options[:foreign_key_name], true]
10:         new_value = new_value.uniq.sort
11:         if old_value != new_value
12:           entry[@options[:many]] = new_value
13:           entry.save
14:         end
15:       end

[Validate]