Sha256: d7d487f378e39cd1767a2e1afa6bef6aacdf301d1aeee73dc78253c354ae3c98

Contents?: true

Size: 433 Bytes

Versions: 72

Compression:

Stored size: 433 Bytes

Contents

# frozen_string_literal: true

module ActiveRecord
  class PredicateBuilder
    class RelationHandler # :nodoc:
      def call(attribute, value)
        if value.eager_loading?
          value = value.send(:apply_join_dependency)
        end

        if value.select_values.empty?
          value = value.select(value.arel_attribute(value.klass.primary_key))
        end

        attribute.in(value.arel)
      end
    end
  end
end

Version data entries

72 entries across 72 versions & 6 rubygems

Version Path
activerecord-5.2.6 lib/active_record/relation/predicate_builder/relation_handler.rb
activerecord-6.0.3.7 lib/active_record/relation/predicate_builder/relation_handler.rb
activerecord-5.2.4.6 lib/active_record/relation/predicate_builder/relation_handler.rb
activerecord-6.0.3.6 lib/active_record/relation/predicate_builder/relation_handler.rb
activerecord-5.2.5 lib/active_record/relation/predicate_builder/relation_handler.rb
activerecord-6.0.3.5 lib/active_record/relation/predicate_builder/relation_handler.rb
activerecord-5.2.4.5 lib/active_record/relation/predicate_builder/relation_handler.rb
activerecord-6.0.3.4 lib/active_record/relation/predicate_builder/relation_handler.rb
activerecord-5.2.4.4 lib/active_record/relation/predicate_builder/relation_handler.rb
activerecord-6.0.3.3 lib/active_record/relation/predicate_builder/relation_handler.rb
activerecord-6.0.3.2 lib/active_record/relation/predicate_builder/relation_handler.rb
activerecord-6.0.3.1 lib/active_record/relation/predicate_builder/relation_handler.rb
activerecord-5.2.4.3 lib/active_record/relation/predicate_builder/relation_handler.rb
activerecord-6.0.3 lib/active_record/relation/predicate_builder/relation_handler.rb
activerecord-6.0.3.rc1 lib/active_record/relation/predicate_builder/relation_handler.rb
activerecord-6.0.2.2 lib/active_record/relation/predicate_builder/relation_handler.rb
activerecord-5.2.4.2 lib/active_record/relation/predicate_builder/relation_handler.rb
argon-1.3.1 vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.2.1/lib/active_record/relation/predicate_builder/relation_handler.rb
symbolic_enum-1.1.5 vendor/bundle/ruby/2.7.0/gems/activerecord-6.0.2.1/lib/active_record/relation/predicate_builder/relation_handler.rb
activerecord-6.0.2.1 lib/active_record/relation/predicate_builder/relation_handler.rb