mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix ids_reader
to respect case sensitive primary key
```ruby car = Car.create!(name: "Tofaş") # Before car.bulb_ids # => SELECT "bulbs".ID FROM "bulbs" WHERE "bulbs"."name" = $1 AND "bulbs"."car_id" = $2 [["name", "defaulty"], ["car_id", 3]] # After car.bulb_ids # => SELECT "bulbs"."ID" FROM "bulbs" WHERE "bulbs"."name" = $1 AND "bulbs"."car_id" = $2 [["name", "defaulty"], ["car_id", 3]] ```
This commit is contained in:
parent
d766b64b7e
commit
bf3f201000
2 changed files with 2 additions and 5 deletions
|
@ -44,10 +44,7 @@ module ActiveRecord
|
|||
if loaded?
|
||||
target.pluck(reflection.association_primary_key)
|
||||
else
|
||||
@association_ids ||= (
|
||||
column = "#{reflection.quoted_table_name}.#{reflection.association_primary_key}"
|
||||
scope.pluck(column)
|
||||
)
|
||||
@association_ids ||= scope.pluck(reflection.association_primary_key)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ ActiveRecord::Schema.define do
|
|||
t.boolean :has_fun, null: false, default: false
|
||||
end
|
||||
|
||||
create_table :bulbs, force: true do |t|
|
||||
create_table :bulbs, primary_key: "ID", force: true do |t|
|
||||
t.integer :car_id
|
||||
t.string :name
|
||||
t.boolean :frickinawesome, default: false
|
||||
|
|
Loading…
Reference in a new issue