From 93861d19e3571206baf51af710cb3f2bd2c65bde Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Thu, 23 Dec 2010 20:41:20 +0000 Subject: Set the create scope to an empty hash in ThroughAssociationScope. For reasoning please see the inline code comments. --- .../lib/active_record/associations/through_association_scope.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3