aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-06-09 15:40:57 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-06-09 15:40:57 -0300
commit19f1cfbb03f8230f5d30cc91c41c3f719813da9d (patch)
treeeb17a616aaab3a6a3659a132a3a992eee824a53a /activerecord
parent66eb847c9dc571421ca2d91bb7de23a788ecd76b (diff)
downloadrails-19f1cfbb03f8230f5d30cc91c41c3f719813da9d.tar.gz
rails-19f1cfbb03f8230f5d30cc91c41c3f719813da9d.tar.bz2
rails-19f1cfbb03f8230f5d30cc91c41c3f719813da9d.zip
Do not try to set the foreign_key again on has_many through
Integration tests are inside protected_attributes test suite. Fixes #15496 Fixes rails/protected_attributes#35
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/associations/has_many_through_association.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_through_association.rb b/activerecord/lib/active_record/associations/has_many_through_association.rb
index 954128064d..f6e08991f7 100644
--- a/activerecord/lib/active_record/associations/has_many_through_association.rb
+++ b/activerecord/lib/active_record/associations/has_many_through_association.rb
@@ -89,7 +89,7 @@ module ActiveRecord
end
def through_scope_attributes
- scope.where_values_hash(through_association.reflection.name.to_s)
+ scope.where_values_hash(through_association.reflection.name.to_s).except!(through_association.reflection.foreign_key)
end
def save_through_record(record)