1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Use placeholder for type_condition predicate

Before:

```
SELECT "comments".* FROM "comments" WHERE "comments"."type" IN ('VerySpecialComment') AND "comments"."post_id" = ? LIMIT ?  [["post_id", 4], ["LIMIT", 1]]
```

After:

```
SELECT "comments".* FROM "comments" WHERE "comments"."type" = ? AND "comments"."post_id" = ? LIMIT ?  [["type", "VerySpecialComment"], ["post_id", 4], ["LIMIT", 1]]
```
This commit is contained in:
Ryuta Kamizono 2019-02-18 01:39:06 +09:00
parent 49bcb008cb
commit 6a1a1e66ea

View file

@ -249,7 +249,7 @@ module ActiveRecord
sti_column = arel_attribute(inheritance_column, table)
sti_names = ([self] + descendants).map(&:sti_name)
sti_column.in(sti_names)
predicate_builder.build(sti_column, sti_names)
end
# Detect the subclass from the inheritance column of attrs. If the inheritance column value