aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/reflection.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-02-26 05:09:22 +0900
committerGitHub <noreply@github.com>2018-02-26 05:09:22 +0900
commit8ff70cad3d634da344d741c49304a69572cbe188 (patch)
tree6423ed73fc689e6cb515df923d44a6cab82c16d1 /activerecord/lib/active_record/reflection.rb
parentdccdcfb5a3743097d94b1c81ed106ebc398e6674 (diff)
downloadrails-8ff70cad3d634da344d741c49304a69572cbe188.tar.gz
rails-8ff70cad3d634da344d741c49304a69572cbe188.tar.bz2
rails-8ff70cad3d634da344d741c49304a69572cbe188.zip
Association creation and finding should work consistently (#32048)
This is an alternative of #29722, and revert of #29601 and a1fcbd9. Currently, association creation and normal association finding doesn't respect `store_full_sti_class`. But eager loading and preloading respect the setting. This means that if set `store_full_sti_class = false` (`true` by default), eager loading and preloading can not find created polymorphic records. Association creation and finding should work consistently.
Diffstat (limited to 'activerecord/lib/active_record/reflection.rb')
-rw-r--r--activerecord/lib/active_record/reflection.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb
index c66c7778f4..da75344bde 100644
--- a/activerecord/lib/active_record/reflection.rb
+++ b/activerecord/lib/active_record/reflection.rb
@@ -193,7 +193,7 @@ module ActiveRecord
klass_scope = klass_join_scope(table, predicate_builder)
if type
- klass_scope.where!(type => foreign_klass.base_class.sti_name)
+ klass_scope.where!(type => foreign_klass.base_class.name)
end
scope_chain_items.inject(klass_scope, &:merge!)