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

Methods

Private Instance methods

[Source]

    # File lib/active_ldap/association/belongs_to_many.rb, line 21
21:       def delete_entries(entries)
22:         entries.each do |entry|
23:           old_value = entry[@options[:many], true]
24:           foreign_key_name = @options[:foreign_key_name]
25:           if foreign_key_name == "dn"
26:             old_value = dn_values_to_string_values(old_value)
27:           end
28:           new_value = old_value - @owner[foreign_key_name, true]
29:           new_value = new_value.uniq.sort
30:           if old_value != new_value
31:             entry[@options[:many]] = new_value
32:             entry.save
33:           end
34:         end
35:       end

[Source]

    # File lib/active_ldap/association/belongs_to_many.rb, line 37
37:       def find_target
38:         values = @owner[@options[:foreign_key_name], true].compact
39:         return [] if values.empty?
40: 
41:         key = @options[:many]
42:         components = values.collect do |value|
43:           [key, value]
44:         end
45:         options = find_options(:filter => [:or, *components])
46:         foreign_class.find(:all, options)
47:       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:         foreign_key_name = @options[:foreign_key_name]
10:         if foreign_key_name == "dn"
11:           old_value = dn_values_to_string_values(old_value)
12:         end
13:         new_value = old_value + @owner[foreign_key_name, true]
14:         new_value = new_value.uniq.sort
15:         if old_value != new_value
16:           entry[@options[:many]] = new_value
17:           entry.save
18:         end
19:       end

[Validate]