class ActiveLdap::Association::BelongsTo
def find_target
def find_target value = @owner[@options[:foreign_key_name]] raise EntryNotFound if value.nil? key = primary_key if key == "dn" result = foreign_class.find(value, find_options) else filter = {key => value} options = find_options(:filter => filter, :limit => 1) result = foreign_class.find(:all, options).first end raise EntryNotFound if result.nil? result end
def have_foreign_key?
def have_foreign_key? not @owner[@options[:foreign_key_name]].nil? end
def replace(entry)
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
def updated?
def updated? @updated end