From c62e88a5ab7bc0a70e36dceda2a0f22995a5d087 Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Fri, 1 Jan 2010 04:14:58 +0530 Subject: Try using cached attribute before creating a new one --- activerecord/lib/active_record/relation/predicate_builder.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/relation/predicate_builder.rb b/activerecord/lib/active_record/relation/predicate_builder.rb index 478d2cb597..08840d102a 100644 --- a/activerecord/lib/active_record/relation/predicate_builder.rb +++ b/activerecord/lib/active_record/relation/predicate_builder.rb @@ -20,7 +20,7 @@ module ActiveRecord arel_table = Arel::Table.new(table_name, @engine) end - attribute = Arel::Attribute.new(arel_table, column.to_sym) + attribute = arel_table[column] || Arel::Attribute.new(arel_table, column.to_sym) case value when Array, Range, ActiveRecord::Associations::AssociationCollection, ActiveRecord::NamedScope::Scope -- cgit v1.2.3