diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-03 14:27:54 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-03 14:40:06 -0700 |
commit | bd78d24bd8168b43ceb167e8d8b3e542486a1bba (patch) | |
tree | 44ab507accad0068da3b12fd2ff04ddb5ed59977 /activerecord | |
parent | 83633b807a3b08aaf5554c0fc793583a064c2472 (diff) | |
download | rails-bd78d24bd8168b43ceb167e8d8b3e542486a1bba.tar.gz rails-bd78d24bd8168b43ceb167e8d8b3e542486a1bba.tar.bz2 rails-bd78d24bd8168b43ceb167e8d8b3e542486a1bba.zip |
be kind to the garbage collector and reuse our visitor object
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/base.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index f6d9050828..ff6be4ff19 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1270,7 +1270,10 @@ MSG attrs = expand_hash_conditions_for_aggregates(attrs) table = Arel::Table.new(self.table_name, :engine => arel_engine, :as => default_table_name) - PredicateBuilder.build_from_hash(arel_engine, attrs, table).map{ |b| b.to_sql }.join(' AND ') + viz = Arel::Visitors.for(arel_engine) + PredicateBuilder.build_from_hash(arel_engine, attrs, table).map { |b| + viz.accept b + }.join(' AND ') end alias_method :sanitize_sql_hash, :sanitize_sql_hash_for_conditions |