Sha256: d38189078b8783a301eb6c74be6a755b61b714f067a428806c935d0e7ffd60c2

Contents?: true

Size: 1.23 KB

Versions: 35

Compression:

Stored size: 1.23 KB

Contents

module ActiveLdap
  module Association
    module HasManyUtils
      private
      def collect_targets(requested_target_key, need_requested_targets=false)
        _foreign_key = foreign_key
        return [] if _foreign_key.nil?

        requested_targets = @owner[requested_target_key, true]
        requested_targets = requested_targets.reject(&:nil?)
        if requested_targets.empty?
          targets = []
        elsif _foreign_key == "dn"
          requested_targets = requested_targets.collect do |target|
            if target.is_a?(DN)
              target
            else
              DN.parse(target)
            end
          end
          targets = []
          requested_targets.each do |target|
            begin
              targets << foreign_class.find(target, find_options)
            rescue EntryNotFound
            end
          end
        else
          components = requested_targets.collect do |value|
            [_foreign_key, value]
          end
          options = find_options(:filter => [:or, *components])
          targets = foreign_class.find(:all, options)
        end

        if need_requested_targets
          [targets, requested_targets]
        else
          targets
        end
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 3 rubygems

Version Path
activeldap-7.2.1 lib/active_ldap/association/has_many_utils.rb
activeldap-7.2.0 lib/active_ldap/association/has_many_utils.rb
activeldap-7.0.0 lib/active_ldap/association/has_many_utils.rb
activeldap-6.1.0 lib/active_ldap/association/has_many_utils.rb
activeldap-6.0.4 lib/active_ldap/association/has_many_utils.rb
activeldap-6.0.3 lib/active_ldap/association/has_many_utils.rb
activeldap-6.0.2 lib/active_ldap/association/has_many_utils.rb
activeldap-6.0.1 lib/active_ldap/association/has_many_utils.rb
activeldap-6.0.0 lib/active_ldap/association/has_many_utils.rb
activeldap-5.2.4 lib/active_ldap/association/has_many_utils.rb
activeldap-5.2.3 lib/active_ldap/association/has_many_utils.rb
activeldap-5.2.2 lib/active_ldap/association/has_many_utils.rb
activeldap-5.2.1 lib/active_ldap/association/has_many_utils.rb
activeldap-5.2.0 lib/active_ldap/association/has_many_utils.rb
activeldap-5.1.1 lib/active_ldap/association/has_many_utils.rb
activeldap-5.1.0 lib/active_ldap/association/has_many_utils.rb
activeldap-3.2.3 lib/active_ldap/association/has_many_utils.rb
powerhome-activeldap-3.2.3 lib/active_ldap/association/has_many_utils.rb
activeldap-4.0.6 lib/active_ldap/association/has_many_utils.rb
activeldap-4.0.5 lib/active_ldap/association/has_many_utils.rb