aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-11-30 12:05:02 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2010-11-30 12:05:02 -0800
commitb6848b6491b75d69c0e1ceaa6a66d86305124d24 (patch)
tree6768cb875ca8f05ea2cabf63458cbf3e2073dc8a /activerecord
parenta9b666b51d28b2e74da630c31327dee7cbe96d37 (diff)
downloadrails-b6848b6491b75d69c0e1ceaa6a66d86305124d24.tar.gz
rails-b6848b6491b75d69c0e1ceaa6a66d86305124d24.tar.bz2
rails-b6848b6491b75d69c0e1ceaa6a66d86305124d24.zip
cleaning up where_values_hash
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/relation.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb
index 3b22be78cb..1ed42ffb95 100644
--- a/activerecord/lib/active_record/relation.rb
+++ b/activerecord/lib/active_record/relation.rb
@@ -319,13 +319,13 @@ module ActiveRecord
end
def where_values_hash
- 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
- ]
+ equalities = @where_values.grep(Arel::Nodes::Equality).find_all { |node|
+ node.left.relation.name == table_name
+ }
+
+ Hash[equalities.map { |where|
+ left, right = where.left, where.right
+ [ left.name, right.respond_to?(:value) ? right.value : right ]
}]
end