diff options
author | Jon Moss <me@jonathanmoss.me> | 2016-05-25 20:51:37 -0400 |
---|---|---|
committer | Jon Moss <me@jonathanmoss.me> | 2016-05-26 18:00:51 -0400 |
commit | 8e2e5f9e3d1f434e265dc104ea9b00ff75702fc3 (patch) | |
tree | 88505e8a287d8127ce2a2e7fb8281f309c5c5f5c /activerecord/lib | |
parent | 28a7c98fe665e40f40d4c69c0729ad0c0436bef2 (diff) | |
download | rails-8e2e5f9e3d1f434e265dc104ea9b00ff75702fc3.tar.gz rails-8e2e5f9e3d1f434e265dc104ea9b00ff75702fc3.tar.bz2 rails-8e2e5f9e3d1f434e265dc104ea9b00ff75702fc3.zip |
Fix `has_one` `enum` `where` queries
Fixes #25128
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/table_metadata.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/table_metadata.rb b/activerecord/lib/active_record/table_metadata.rb index 0faad48ce3..a1326aa359 100644 --- a/activerecord/lib/active_record/table_metadata.rb +++ b/activerecord/lib/active_record/table_metadata.rb @@ -44,7 +44,8 @@ module ActiveRecord def associated_table(table_name) return self if table_name == arel_table.name - association = klass._reflect_on_association(table_name) + association = klass._reflect_on_association(table_name) || klass._reflect_on_association(table_name.singularize) + if association && !association.polymorphic? association_klass = association.klass arel_table = association_klass.arel_table.alias(table_name) |