Class ActiveLdap::Association::BelongsTo
In: lib/active_ldap/association/belongs_to.rb
Parent: Proxy
Error AttributeAssignmentError AdapterNotSpecified OperationNotPermitted RequiredObjectClassMissed ConnectionError RequiredAttributeMissed LdifInvalid LdapError DistinguishedNameNotSetError EntryNotFound SaveError StrongAuthenticationRequired AdapterNotFound ConnectionNotEstablished TimeoutError AuthenticationError AttributeValueInvalid EntryNotSaved DistinguishedNameInputInvalid EntryAlreadyExist ObjectClassError UnknownAttribute EntryInvalid DeleteError ConfigurationError DistinguishedNameInvalid DistinguishedName Base Reloadable::Deprecated Reloadable::Subclasses Enumerable Ldif Collection EntryAttribute StandardError Children HasManyWrap HasMany 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 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 ClassMethods Tree Acts Command Update Common ModifyNameRecordLoadable AddOperationModifiable DeleteOperationModifiable ReplaceOperationModifiable ModifyRecordLoadable DeleteRecordLoadable AddRecordLoadable ContentRecordLoadable LDIF Delete Find Operations GetTextSupport Escape ClassMethods Normalizable Attributes 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/jndi.rb Adapter Helper GetTextFallback ClassMethods HumanReadable Salt UserPassword ClassMethods Connection ActiveLdap dot/m_44_0.png

Methods

Public Instance methods

[Source]

    # File lib/active_ldap/association/belongs_to.rb, line 6
 6:       def replace(entry)
 7:         if entry.nil?
 8:           @target = @owner[@options[:foreign_key_name]] = nil
 9:         else
10:           @target = (Proxy === entry ? entry.target : entry)
11:           infect_connection(@target)
12:           unless entry.new_entry?
13:             @owner[@options[:foreign_key_name]] = entry[primary_key]
14:           end
15:           @updated = true
16:         end
17: 
18:         loaded
19:         entry
20:       end

[Source]

    # File lib/active_ldap/association/belongs_to.rb, line 22
22:       def updated?
23:         @updated
24:       end

Private Instance methods

[Source]

    # File lib/active_ldap/association/belongs_to.rb, line 31
31:       def find_target
32:         value = @owner[@options[:foreign_key_name]]
33:         raise EntryNotFound if value.nil?
34:         key = primary_key
35:         if key == "dn"
36:           result = foreign_class.find(value, find_options)
37:         else
38:           filter = {key => value}
39:           options = find_options(:filter => filter, :limit => 1)
40:           result = foreign_class.find(:all, options).first
41:         end
42:         raise EntryNotFound if result.nil?
43:         result
44:       end

[Source]

    # File lib/active_ldap/association/belongs_to.rb, line 27
27:       def have_foreign_key?
28:         not @owner[@options[:foreign_key_name]].nil?
29:       end

[Validate]