aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorJoshua Cody <josh@joshuacody.net>2014-10-29 07:48:25 -0500
committerJoshua Cody <josh@joshuacody.net>2014-10-29 07:54:20 -0500
commit8e16a00de4f77f15e405d083d535b92a23779d9d (patch)
treeac400e5f0d87718f0f0f1c5fe3d050e614add332 /activerecord/lib/active_record
parent76bec5939c4855f7522ada2f38409357778810ce (diff)
downloadrails-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.rb4
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