diff options
author | Nick LaMuro <nicklamuro@gmail.com> | 2017-01-06 17:59:30 -0600 |
---|---|---|
committer | Nick LaMuro <nicklamuro@gmail.com> | 2017-01-06 17:59:30 -0600 |
commit | c322b7c2b1ace59921e0613151b26c8256e62a82 (patch) | |
tree | 34c17c87f11d79ffa2be3cab4204b1b396636f8e /activerecord | |
parent | b42e594a43e00d00b018868481927584d358f756 (diff) | |
download | rails-c322b7c2b1ace59921e0613151b26c8256e62a82.tar.gz rails-c322b7c2b1ace59921e0613151b26c8256e62a82.tar.bz2 rails-c322b7c2b1ace59921e0613151b26c8256e62a82.zip |
Adds .to_s to table_name call
Avoids a NoMethodError when table_name is a symbol instead of a string.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/table_metadata.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/table_metadata.rb b/activerecord/lib/active_record/table_metadata.rb index b618e5cfcd..71efc1829a 100644 --- a/activerecord/lib/active_record/table_metadata.rb +++ b/activerecord/lib/active_record/table_metadata.rb @@ -44,7 +44,7 @@ module ActiveRecord end def associated_table(table_name) - association = klass._reflect_on_association(table_name) || klass._reflect_on_association(table_name.singularize) + association = klass._reflect_on_association(table_name) || klass._reflect_on_association(table_name.to_s.singularize) if !association && table_name == arel_table.name return self |