diff options
Diffstat (limited to 'activerecord/lib/active_record/relation/predicate_builder/association_query_handler.rb')
-rw-r--r-- | activerecord/lib/active_record/relation/predicate_builder/association_query_handler.rb | 32 |
1 files changed, 1 insertions, 31 deletions
diff --git a/activerecord/lib/active_record/relation/predicate_builder/association_query_handler.rb b/activerecord/lib/active_record/relation/predicate_builder/association_query_handler.rb index 9141d9c537..2fe0f81cab 100644 --- a/activerecord/lib/active_record/relation/predicate_builder/association_query_handler.rb +++ b/activerecord/lib/active_record/relation/predicate_builder/association_query_handler.rb @@ -1,35 +1,5 @@ module ActiveRecord class PredicateBuilder - class AssociationQueryHandler # :nodoc: - def self.value_for(table, column, value) - associated_table = table.associated_table(column) - if associated_table.polymorphic_association? - case value.is_a?(Array) ? value.first : value - when Base, Relation - value = [value] unless value.is_a?(Array) - klass = PolymorphicArrayValue - end - end - - klass ||= AssociationQueryValue - klass.new(associated_table, value) - end - - def initialize(predicate_builder) - @predicate_builder = predicate_builder - end - - def call(attribute, value) - predicate_builder.build_from_hash(value.queries) - end - - # TODO Change this to private once we've dropped Ruby 2.2 support. - # Workaround for Ruby 2.2 "private attribute?" warning. - protected - - attr_reader :predicate_builder - end - class AssociationQueryValue # :nodoc: attr_reader :associated_table, :value @@ -39,7 +9,7 @@ module ActiveRecord end def queries - { associated_table.association_foreign_key.to_s => ids } + [associated_table.association_foreign_key.to_s => ids] end private |