Class: ActiveLdap::Association::BelongsTo — activeldap - ActiveLdap

Class: ActiveLdap::Association::BelongsTo

Inherits:
Proxy
  • Object
show all
Defined in:
lib/active_ldap/association/belongs_to.rb

Instance Method Summary (collapse)

Methods inherited from Proxy

#===, #exists?, #initialize, #loaded, #loaded?, #proxy_respond_to?, #reload, #reset, #respond_to?, #target, #target=

Constructor Details

This class inherits a constructor from ActiveLdap::Association::Proxy

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ActiveLdap::Association::Proxy

Instance Method Details

- (Object) replace(entry)



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/active_ldap/association/belongs_to.rb', line 6

def replace(entry)
  if entry.nil?
    @target = @owner[@options[:foreign_key_name]] = nil
  else
    @target = (Proxy === entry ? entry.target : entry)
    infect_connection(@target)
    unless entry.new_entry?
      @owner[@options[:foreign_key_name]] = entry[primary_key]
    end
    @updated = true
  end

  loaded
  entry
end

- (Boolean) updated?

Returns:

  • (Boolean)


22
23
24
# File 'lib/active_ldap/association/belongs_to.rb', line 22

def updated?
  @updated
end