### Home Classes Methods

### In Files

- lib/active_ldap/association/proxy.rb

### Parent

Object

### Methods

- ::new
- #===
- #exists?
- #find_options
- #foreign_class
- #foreign_key
- #have_foreign_key?
- #infect_connection
- #load_target
- #loaded
- #loaded?
- #method_missing
- #primary_key
- #proxy_respond_to?
- #reload
- #reset
- #respond_to?
- #target
- #target=

### Files

- USAGE

### Class/Module Index

Quicksearch

- ActiveLdap
- ActiveLdap::ActionController
- ActiveLdap::ActionController::LdapBenchmarking
- ActiveLdap::Acts
- ActiveLdap::Acts::Tree
- ActiveLdap::Acts::Tree::ClassMethods
- ActiveLdap::Adapter
- ActiveLdap::Adapter::Base
- ActiveLdap::Adapter::Jndi
- ActiveLdap::Adapter::JndiConnection
- ActiveLdap::Adapter::JndiConnection::ModifyRecord
- ActiveLdap::Adapter::JndiConnection::Scope
- ActiveLdap::Adapter::Ldap
- ActiveLdap::Adapter::Ldap::Method
- ActiveLdap::Adapter::Ldap::Method::Base
- ActiveLdap::Adapter::Ldap::Method::Plain
- ActiveLdap::Adapter::Ldap::Method::SSL
- ActiveLdap::Adapter::Ldap::Method::TLS
- ActiveLdap::Adapter::NetLdap
- ActiveLdap::Association
- ActiveLdap::Association::BelongsTo
- ActiveLdap::Association::BelongsToMany
- ActiveLdap::Association::Children
- ActiveLdap::Association::Collection
- ActiveLdap::Association::HasMany
- ActiveLdap::Association::HasManyUtils
- ActiveLdap::Association::HasManyWrap
- ActiveLdap::Association::Proxy
- ActiveLdap::Associations
- ActiveLdap::Associations::ClassMethods
- ActiveLdap::AttributeMethods
- ActiveLdap::AttributeMethods::BeforeTypeCast
- ActiveLdap::AttributeMethods::Dirty
- ActiveLdap::AttributeMethods::Query
- ActiveLdap::AttributeMethods::Read
- ActiveLdap::AttributeMethods::Write
- ActiveLdap::Attributes
- ActiveLdap::Attributes::ClassMethods
- ActiveLdap::Attributes::Normalizable
- ActiveLdap::Callbacks
- ActiveLdap::Callbacks::ClassMethods
- ActiveLdap::Command
- ActiveLdap::Compatible
- ActiveLdap::Configuration
- ActiveLdap::Configuration::ClassMethods
- ActiveLdap::Connection
- ActiveLdap::Connection::ClassMethods
- ActiveLdap::DN
- ActiveLdap::DistinguishedName
- ActiveLdap::DistinguishedName::Parser
- ActiveLdap::Entry
- ActiveLdap::EntryAttribute
- ActiveLdap::Escape
- ActiveLdap::Generators
- ActiveLdap::Generators::ModelGenerator
- ActiveLdap::Generators::ScaffoldGenerator
- ActiveLdap::GetText
- ActiveLdap::GetText::Parser
- ActiveLdap::GetTextSupport
- ActiveLdap::Helper
- ActiveLdap::HumanReadable
- ActiveLdap::HumanReadable::ClassMethods
- ActiveLdap::LDIF
- ActiveLdap::LdapError
- ActiveLdap::Ldif
- ActiveLdap::Ldif::AddRecord
- ActiveLdap::Ldif::Attribute
- ActiveLdap::Ldif::Attributes
- ActiveLdap::Ldif::ChangeRecord
- ActiveLdap::Ldif::ChangeRecord::Control
- ActiveLdap::Ldif::ContentRecord
- ActiveLdap::Ldif::DeleteRecord
- ActiveLdap::Ldif::ModifyDNRecord
- ActiveLdap::Ldif::ModifyNameRecord
- ActiveLdap::Ldif::ModifyRDNRecord
- ActiveLdap::Ldif::ModifyRecord
- ActiveLdap::Ldif::ModifyRecord::AddOperation
- ActiveLdap::Ldif::ModifyRecord::DeleteOperation
- ActiveLdap::Ldif::ModifyRecord::Operation
- ActiveLdap::Ldif::ModifyRecord::ReplaceOperation
- ActiveLdap::Ldif::Parser
- ActiveLdap::Ldif::Record
- ActiveLdap::Ldif::Scanner
- ActiveLdap::LogSubscriber
- ActiveLdap::ObjectClass
- ActiveLdap::ObjectClass::ClassMethods
- ActiveLdap::Operations
- ActiveLdap::Operations::ClassOnlyDelete
- ActiveLdap::Operations::ClassOnlyUpdate
- ActiveLdap::Operations::Common
- ActiveLdap::Operations::Delete
- ActiveLdap::Operations::Find
- ActiveLdap::Operations::LDIF
- ActiveLdap::Operations::LDIF::AddRecordLoadable
- ActiveLdap::Operations::LDIF::ContentRecordLoadable
- ActiveLdap::Operations::LDIF::DeleteRecordLoadable
- ActiveLdap::Operations::LDIF::ModifyNameRecordLoadable
- ActiveLdap::Operations::LDIF::ModifyRecordLoadable
- ActiveLdap::Operations::LDIF::ModifyRecordLoadable::AddOperationModifiable
- ActiveLdap::Operations::LDIF::ModifyRecordLoadable::DeleteOperationModifiable
- ActiveLdap::Operations::LDIF::ModifyRecordLoadable::ReplaceOperationModifiable
- ActiveLdap::Operations::Update
- ActiveLdap::Persistence
- ActiveLdap::Populate
- ActiveLdap::Railtie
- ActiveLdap::Railties
- ActiveLdap::Railties::ControllerRuntime
- ActiveLdap::Railties::ControllerRuntime::ClassMethods
- ActiveLdap::Schema
- ActiveLdap::Schema::Attribute
- ActiveLdap::Schema::Entry
- ActiveLdap::Schema::ObjectClass
- ActiveLdap::Schema::Syntax
- ActiveLdap::Schema::Syntaxes
- ActiveLdap::Schema::Syntaxes::Base
- ActiveLdap::Schema::Syntaxes::BitString
- ActiveLdap::Schema::Syntaxes::Boolean
- ActiveLdap::Schema::Syntaxes::CountryString
- ActiveLdap::Schema::Syntaxes::DirectoryString
- ActiveLdap::Schema::Syntaxes::DistinguishedName
- ActiveLdap::Schema::Syntaxes::GeneralizedTime
- ActiveLdap::Schema::Syntaxes::Integer
- ActiveLdap::Schema::Syntaxes::JPEG
- ActiveLdap::Schema::Syntaxes::NameAndOptionalUID
- ActiveLdap::Schema::Syntaxes::NumericString
- ActiveLdap::Schema::Syntaxes::OID
- ActiveLdap::Schema::Syntaxes::ObjectSecurityDescriptor
- ActiveLdap::Schema::Syntaxes::OctetString
- ActiveLdap::Schema::Syntaxes::OtherMailbox
- ActiveLdap::Schema::Syntaxes::PostalAddress
- ActiveLdap::Schema::Syntaxes::PrintableString
- ActiveLdap::Schema::Syntaxes::TelephoneNumber
- ActiveLdap::UserPassword
- ActiveLdap::UserPassword::Salt
- ActiveLdap::Validations
- ActiveLdap::XML
- ActiveLdap::Xml
- ActiveLdap::Xml::Serializer
- LDAP
- LDAP::Conn
- LDAP::Mod
- Net
- Net::LDAP
- Net::LDAP::Entry
- ActionView
- ActionView::Base
- URI
- URI::LDAPS
- Object
- Timeout

No matching classes.

# ActiveLdap::Association::Proxy

### Public Class Methods

new(owner, options) click to toggle source

    # File lib/active_ldap/association/proxy.rb, line 8
    def initialize(owner, options)
      @owner = owner
      @options = options
      reset
      extend(options[:extend]) if options[:extend]
    end

### Public Instance Methods

===(other) click to toggle source

    # File lib/active_ldap/association/proxy.rb, line 20
    def ===(other)
      load_target and other === @target
    end

exists?() click to toggle source

    # File lib/active_ldap/association/proxy.rb, line 51
    def exists?
      load_target
      not @target.nil?
    end

loaded() click to toggle source

    # File lib/active_ldap/association/proxy.rb, line 38
    def loaded
      @loaded = true
    end

loaded?() click to toggle source

    # File lib/active_ldap/association/proxy.rb, line 34
    def loaded?
      @loaded
    end

proxy_respond_to?(symbol, include_priv=false) click to toggle source
Alias for: respond_to?
reload() click to toggle source

    # File lib/active_ldap/association/proxy.rb, line 29
    def reload
      reset
      load_target
    end

reset() click to toggle source

    # File lib/active_ldap/association/proxy.rb, line 24
    def reset
      @target = nil
      @loaded = false
    end

respond_to?(symbol, include_priv=false) click to toggle source

    # File lib/active_ldap/association/proxy.rb, line 15
    def respond_to?(symbol, include_priv=false)
      proxy_respond_to?(symbol, include_priv) or
        (load_target && @target.respond_to?(symbol, include_priv))
    end

Also aliased as: proxy_respond_to?
target() click to toggle source

    # File lib/active_ldap/association/proxy.rb, line 42
    def target
      @target
    end

target=(target) click to toggle source

    # File lib/active_ldap/association/proxy.rb, line 46
    def target=(target)
      @target = target
      loaded
    end

### Private Instance Methods

find_options(options={}) click to toggle source

    # File lib/active_ldap/association/proxy.rb, line 93
    def find_options(options={})
      if @owner.connection != @owner.class.connection
        {:connection => @owner.connection}.merge(options)
      else
        options
      end
    end

foreign_class() click to toggle source

    # File lib/active_ldap/association/proxy.rb, line 62
    def foreign_class
      klass = @owner.class.associated_class(@options[:association_id])
      klass = @owner.class.module_eval(klass) if klass.is_a?(String)
      klass
    end

foreign_key() click to toggle source

    # File lib/active_ldap/association/proxy.rb, line 76
    def foreign_key
      @options[:foreign_key_name] || foreign_class.dn_attribute
    end

have_foreign_key?() click to toggle source

    # File lib/active_ldap/association/proxy.rb, line 68
    def have_foreign_key?
      false
    end

infect_connection(target) click to toggle source

    # File lib/active_ldap/association/proxy.rb, line 101
    def infect_connection(target)
      conn = @owner.instance_variable_get("@connection")
      target.connection = conn if conn
    end

load_target() click to toggle source

    # File lib/active_ldap/association/proxy.rb, line 80
    def load_target
      if !@owner.new_entry? or have_foreign_key?
        begin
          @target = find_target unless loaded?
        rescue EntryNotFound
          reset
        end
      end

      loaded if target
      target
    end

method_missing(method, *args, &block) click to toggle source

    # File lib/active_ldap/association/proxy.rb, line 57
    def method_missing(method, *args, &block)
      load_target
      @target.send(method, *args, &block)
    end

primary_key() click to toggle source

    # File lib/active_ldap/association/proxy.rb, line 72
    def primary_key
      @options[:primary_key_name] || @owner.dn_attribute
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.