diff options
author | Joshua Cody <josh@joshuacody.net> | 2014-10-29 07:48:25 -0500 |
---|---|---|
committer | Joshua Cody <josh@joshuacody.net> | 2014-10-29 07:54:20 -0500 |
commit | 8e16a00de4f77f15e405d083d535b92a23779d9d (patch) | |
tree | ac400e5f0d87718f0f0f1c5fe3d050e614add332 /activerecord/lib/active_record | |
parent | 76bec5939c4855f7522ada2f38409357778810ce (diff) | |
download | rails-8e16a00de4f77f15e405d083d535b92a23779d9d.tar.gz rails-8e16a00de4f77f15e405d083d535b92a23779d9d.tar.bz2 rails-8e16a00de4f77f15e405d083d535b92a23779d9d.zip |
Rely on through table name in has_many fixtures
Rather than using the association's join_table method, which
constructs a table name from conventions, this should rely on the
through reflection's table_name to be resilient to tables that were
not automatically named.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/fixtures.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index 125a119b5f..da0307392f 100644 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -703,6 +703,10 @@ module ActiveRecord def lhs_key @association.through_reflection.foreign_key end + + def join_table + @association.through_reflection.table_name + end end private |