Permalink
Browse files

Set the create scope to an empty hash in ThroughAssociationScope. For…

… reasoning please see the inline code comments.
  • Loading branch information...
1 parent ac67eee commit 93861d19e3571206baf51af710cb3f2bd2c65bde @jonleighton jonleighton committed Dec 23, 2010
Showing with 5 additions and 1 deletion.
  1. +5 −1 activerecord/lib/active_record/associations/through_association_scope.rb
View
6 activerecord/lib/active_record/associations/through_association_scope.rb
@@ -35,8 +35,12 @@ def construct_find_scope
}
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

0 comments on commit 93861d1

Please sign in to comment.