Class ActiveLdap::Association::HasManyWrap
In: lib/active_ldap/association/has_many_wrap.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

Included Modules

HasManyUtils

Private Instance methods

[Source]

    # File lib/active_ldap/association/has_many_wrap.rb, line 19
19:       def delete_entries(entries)
20:         old_value = @owner[@options[:wrap], true]
21:         new_value = old_value - entries.collect {|entry| entry[primary_key]}
22:         new_value = new_value.uniq.sort
23:         if old_value != new_value
24:           @owner[@options[:wrap]] = new_value
25:           @owner.save
26:         end
27:       end

[Source]

    # File lib/active_ldap/association/has_many_wrap.rb, line 29
29:       def find_target
30:         targets, requested_targets = collect_targets(:wrap, true)
31:         return [] if targets.nil?
32: 
33:         found_targets = {}
34:         foreign_base_key = primary_key
35:         targets.each do |target|
36:           found_targets[target.send(foreign_base_key)] ||= target
37:         end
38: 
39:         klass = foreign_class
40:         requested_targets.collect do |name|
41:           found_targets[name] || klass.new(name)
42:         end
43:       end

[Source]

    # File lib/active_ldap/association/has_many_wrap.rb, line 10
10:       def insert_entry(entry)
11:         old_value = @owner[@options[:wrap], true]
12:         new_value = (old_value + entry[primary_key, true]).uniq.sort
13:         if old_value != new_value
14:           @owner[@options[:wrap]] = new_value
15:           @owner.save
16:         end
17:       end

[Validate]