Sha256: 57ed73939766f78ab449b3ec625f08be0f5d33a5204cc224205a109ffa2f26c6

Contents?: true

Size: 622 Bytes

Versions: 34

Compression:

Stored size: 622 Bytes

Contents

module ActiveRecord
  module Associations
    class JoinDependency
      class JoinAssociation
        def build_constraint(reflection, table, key, foreign_table, foreign_key)
          # CPK
          # constraint = table[key].eq(foreign_table[foreign_key])
          constraint = cpk_join_predicate(table, key, foreign_table, foreign_key)

          if reflection.klass.finder_needs_type_condition?
            constraint = table.create_and([
              constraint,
              reflection.klass.send(:type_condition, table)
            ])
          end

          constraint
        end
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
composite_primary_keys-6.0.8 lib/composite_primary_keys/associations/join_dependency/join_association.rb
composite_primary_keys-6.0.7 lib/composite_primary_keys/associations/join_dependency/join_association.rb
composite_primary_keys-6.0.6 lib/composite_primary_keys/associations/join_dependency/join_association.rb
composite_primary_keys-6.0.5 lib/composite_primary_keys/associations/join_dependency/join_association.rb
composite_primary_keys-6.0.3 lib/composite_primary_keys/associations/join_dependency/join_association.rb
composite_primary_keys-5.0.14 lib/composite_primary_keys/associations/join_dependency/join_association.rb
composite_primary_keys-6.0.1 lib/composite_primary_keys/associations/join_dependency/join_association.rb
composite_primary_keys-6.0.0 lib/composite_primary_keys/associations/join_dependency/join_association.rb
composite_primary_keys-5.0.13 lib/composite_primary_keys/associations/join_dependency/join_association.rb
composite_primary_keys-5.0.12 lib/composite_primary_keys/associations/join_dependency/join_association.rb
composite_primary_keys-5.0.11 lib/composite_primary_keys/associations/join_dependency/join_association.rb
composite_primary_keys-5.0.10 lib/composite_primary_keys/associations/join_dependency/join_association.rb
composite_primary_keys-5.0.9 lib/composite_primary_keys/associations/join_dependency/join_association.rb
composite_primary_keys-5.0.8 lib/composite_primary_keys/associations/join_dependency/join_association.rb
composite_primary_keys-5.0.6 lib/composite_primary_keys/associations/join_dependency/join_association.rb
composite_primary_keys-5.0.5 lib/composite_primary_keys/associations/join_dependency/join_association.rb
composite_primary_keys-5.0.4 lib/composite_primary_keys/associations/join_dependency/join_association.rb
composite_primary_keys-5.0.2 lib/composite_primary_keys/associations/join_dependency/join_association.rb
composite_primary_keys-5.0.1 lib/composite_primary_keys/associations/join_dependency/join_association.rb
composite_primary_keys-5.0.0 lib/composite_primary_keys/associations/join_dependency/join_association.rb