Sha256: e570e7380517e8c3dc4e6fd4362342fcb967372c2dedfbafcf481caade48d483

Contents?: true

Size: 572 Bytes

Versions: 1

Compression:

Stored size: 572 Bytes

Contents

module ActiveRecord
  class PredicateBuilder
    class AssociationQueryValue
      def queries
        # CPK
        if associated_table.association_join_foreign_key.is_a?(Array)
          if ids.is_a?(ActiveRecord::Relation)
            ids.map do |id|
              associated_table.association_join_foreign_key.zip(id.id).to_h
            end
          else
            [associated_table.association_join_foreign_key.zip(ids).to_h]
          end
        else
          [associated_table.association_join_foreign_key.to_s => ids]
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
composite_primary_keys-12.0.10 lib/composite_primary_keys/relation/predicate_builder/association_query_value.rb