Class: ActiveRecord::PredicateBuilder::RelationHandler
- Inherits:
-
Object
- Object
- ActiveRecord::PredicateBuilder::RelationHandler
- Defined in:
- 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 17 18 19 20 21 |
# File '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? model = value.model if model.composite_primary_key? raise ArgumentError, "Cannot map composite primary key #{model.primary_key} to #{attribute.name}" else value = value.select(value.table[model.primary_key]) end end attribute.in(value.arel) end |