Class: ActiveRecord::PredicateBuilder::RelationHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/relation/predicate_builder/relation_handler.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#call(attribute, value) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/relation/predicate_builder/relation_handler.rb', line 6

def call(attribute, value)
  if value.eager_loading?
    value = value.send(:apply_join_dependency)
  end

  if value.select_values.empty?
    value = value.select(value.table[value.klass.primary_key])
  end

  attribute.in(value.arel)
end