Class: ActiveRecord::PredicateBuilder::PolymorphicArrayValue

Inherits:
Object
  • Object
show all
Defined in:
activerecord/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(associated_table, values) ⇒ PolymorphicArrayValue

Returns a new instance of PolymorphicArrayValue.



6
7
8
9
# File 'activerecord/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb', line 6

def initialize(associated_table, values)
  @associated_table = associated_table
  @values = values
end

Instance Method Details

#queriesObject



11
12
13
14
15
16
17
18
# File 'activerecord/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb', line 11

def queries
  type_to_ids_mapping.map do |type, ids|
    {
      associated_table.association_foreign_type.to_s => type,
      associated_table.association_foreign_key.to_s => ids
    }
  end
end