aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
diff options
context:
space:
mode:
authorGabe da Silveira <gabe@websaviour.com>2009-08-09 12:53:22 -0700
committerPratik Naik <pratiknaik@gmail.com>2009-08-10 00:30:44 +0100
commit00d6c766608f90ce64f11feb98786cbc7f71b89d (patch)
treefacb90eba8022d93b0cc9c3aba566694617ce583 /activerecord/lib/active_record/associations
parent810b59a2a9da3e85bc85d2617ae781c1b3645af4 (diff)
downloadrails-00d6c766608f90ce64f11feb98786cbc7f71b89d.tar.gz
rails-00d6c766608f90ce64f11feb98786cbc7f71b89d.tar.bz2
rails-00d6c766608f90ce64f11feb98786cbc7f71b89d.zip
Enable has_many :through for going through a has_one association on the join model [#2719 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r--activerecord/lib/active_record/associations/through_association_scope.rb2
1 files changed, 1 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 8e7ce33814..16b6123439 100644
--- a/activerecord/lib/active_record/associations/through_association_scope.rb
+++ b/activerecord/lib/active_record/associations/through_association_scope.rb
@@ -93,7 +93,7 @@ module ActiveRecord
# Construct attributes for :through pointing to owner and associate.
def construct_join_attributes(associate)
# TODO: revist this to allow it for deletion, supposing dependent option is supported
- raise ActiveRecord::HasManyThroughCantAssociateThroughHasManyReflection.new(@owner, @reflection) if @reflection.source_reflection.macro == :has_many
+ raise ActiveRecord::HasManyThroughCantAssociateThroughHasOneOrManyReflection.new(@owner, @reflection) if [:has_one, :has_many].include?(@reflection.source_reflection.macro)
join_attributes = construct_owner_attributes(@reflection.through_reflection).merge(@reflection.source_reflection.primary_key_name => associate.id)