Permalink
Browse files

Build PredicateBuilder object only when needed

  • Loading branch information...
1 parent da32661 commit 2ff73039bdb6880af5586d8e4d6960b34cdf00ce @lifo lifo committed Apr 21, 2010
Showing with 1 addition and 3 deletions.
  1. +1 −3 activerecord/lib/active_record/relation/query_methods.rb
@@ -187,15 +187,13 @@ def build_arel
def build_where(*args)
return if args.blank?
- builder = PredicateBuilder.new(table.engine)
-
opts = args.first
case opts
when String, Array
@klass.send(:sanitize_sql, args.size > 1 ? args : opts)
when Hash
attributes = @klass.send(:expand_hash_conditions_for_aggregates, opts)
- builder.build_from_hash(attributes, table)
+ PredicateBuilder.new(table.engine).build_from_hash(attributes, table)
else
opts
end

0 comments on commit 2ff7303

Please sign in to comment.