aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2010-12-23 20:41:20 +0000
committerJon Leighton <j@jonathanleighton.com>2010-12-26 18:46:58 +0000
commit93861d19e3571206baf51af710cb3f2bd2c65bde (patch)
treebac342a3a05c6c3646585b00c204935a6038b052
parentac67eee4e65082f4312976bd89bbec6f71025aa1 (diff)
downloadrails-93861d19e3571206baf51af710cb3f2bd2c65bde.tar.gz
rails-93861d19e3571206baf51af710cb3f2bd2c65bde.tar.bz2
rails-93861d19e3571206baf51af710cb3f2bd2c65bde.zip
Set the create scope to an empty hash in ThroughAssociationScope. For reasoning please see the inline code comments.
-rw-r--r--activerecord/lib/active_record/associations/through_association_scope.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/through_association_scope.rb b/activerecord/lib/active_record/associations/through_association_scope.rb
index 7cb039859c..7a0fa08f66 100644
--- a/activerecord/lib/active_record/associations/through_association_scope.rb
+++ b/activerecord/lib/active_record/associations/through_association_scope.rb
@@ -35,8 +35,12 @@ module ActiveRecord
}
end
+ # This scope affects the creation of the associated records (not the join records). At the
+ # moment we only support creating on a :through association when the source reflection is a
+ # belongs_to. Thus it's not necessary to set a foreign key on the associated record(s), so
+ # this scope has can legitimately be empty.
def construct_create_scope
- construct_owner_attributes(@reflection)
+ { }
end
def aliased_through_table