aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2010-10-31 10:04:56 +0000
committerJon Leighton <j@jonathanleighton.com>2010-10-31 10:04:56 +0000
commitd010fb13ef622bdb781e3134005fc849db4c9bea (patch)
tree8ca8beb957fb51923938c4e7befa35d44e711dba /activerecord/lib/active_record/relation.rb
parentfc276e5635821e65c04b8961170cc6bd3c11b923 (diff)
parent3cf85fb4fcdae65a4d5a1a5c418492ea0cf9ad6d (diff)
downloadrails-d010fb13ef622bdb781e3134005fc849db4c9bea.tar.gz
rails-d010fb13ef622bdb781e3134005fc849db4c9bea.tar.bz2
rails-d010fb13ef622bdb781e3134005fc849db4c9bea.zip
Merge branch 'master' into nested_has_many_through
Conflicts: activerecord/lib/active_record/associations/has_many_association.rb activerecord/lib/active_record/associations/through_association_scope.rb
Diffstat (limited to 'activerecord/lib/active_record/relation.rb')
-rw-r--r--activerecord/lib/active_record/relation.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb
index 58f7b74198..3b22be78cb 100644
--- a/activerecord/lib/active_record/relation.rb
+++ b/activerecord/lib/active_record/relation.rb
@@ -319,8 +319,13 @@ module ActiveRecord
end
def where_values_hash
- Hash[@where_values.find_all {|w| w.respond_to?(:operator) && w.operator == :== }.map {|where|
- [where.operand1.name, where.operand2.respond_to?(:value) ? where.operand2.value : where.operand2]
+ Hash[@where_values.find_all { |w|
+ w.respond_to?(:operator) && w.operator == :== && w.left.relation.name == table_name
+ }.map { |where|
+ [
+ where.left.name,
+ where.right.respond_to?(:value) ? where.right.value : where.right
+ ]
}]
end