aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2019-02-18 01:39:06 +0900
committerRyuta Kamizono <kamipo@gmail.com>2019-02-18 01:39:06 +0900
commit6a1a1e66ea7a917942bd8369fa8dbfedce391dab (patch)
treee3bca9f404a5a0d1dc5e3c13a49c9d4faf3ff444
parent49bcb008cbaf0fa2db727ae58e7e27015a7ae02c (diff)
downloadrails-6a1a1e66ea7a917942bd8369fa8dbfedce391dab.tar.gz
rails-6a1a1e66ea7a917942bd8369fa8dbfedce391dab.tar.bz2
rails-6a1a1e66ea7a917942bd8369fa8dbfedce391dab.zip
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]] ```
-rw-r--r--activerecord/lib/active_record/inheritance.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/inheritance.rb b/activerecord/lib/active_record/inheritance.rb
index 138fd1cf53..9570bc6f86 100644
--- a/activerecord/lib/active_record/inheritance.rb
+++ b/activerecord/lib/active_record/inheritance.rb
@@ -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