aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2010-04-21 02:43:36 +0100
committerPratik Naik <pratiknaik@gmail.com>2010-04-21 02:43:52 +0100
commit2ff73039bdb6880af5586d8e4d6960b34cdf00ce (patch)
tree933e4b0c6b4ca88c2ba02063e22959c41a230105 /activerecord
parentda32661f10f0d14f392e987c50199c5ee71ed6e8 (diff)
downloadrails-2ff73039bdb6880af5586d8e4d6960b34cdf00ce.tar.gz
rails-2ff73039bdb6880af5586d8e4d6960b34cdf00ce.tar.bz2
rails-2ff73039bdb6880af5586d8e4d6960b34cdf00ce.zip
Build PredicateBuilder object only when needed
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/relation/query_methods.rb4
1 files changed, 1 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb
index 09332418d5..58af930446 100644
--- a/activerecord/lib/active_record/relation/query_methods.rb
+++ b/activerecord/lib/active_record/relation/query_methods.rb
@@ -187,15 +187,13 @@ module ActiveRecord
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