diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-03-06 13:18:14 -0800 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-03-06 13:25:12 -0800 |
commit | 45c36ea0961d015bf040043c7ab2ac2069d3b92f (patch) | |
tree | ca636d763023addc41c49053686a910bde7ad17a /activerecord | |
parent | 028e54c63df84ad1ded1fb9c438eed540564552c (diff) | |
download | rails-45c36ea0961d015bf040043c7ab2ac2069d3b92f.tar.gz rails-45c36ea0961d015bf040043c7ab2ac2069d3b92f.tar.bz2 rails-45c36ea0961d015bf040043c7ab2ac2069d3b92f.zip |
refactoring build_where
Signed-off-by: wycats <wycats@gmail.com>
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 25ffa7860e..6c4e84a958 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -184,16 +184,16 @@ module ActiveRecord builder = PredicateBuilder.new(table.engine) - conditions = if [String, Array].include?(args.first.class) - @klass.send(:sanitize_sql, args.size > 1 ? args : args.first) - elsif args.first.is_a?(Hash) - attributes = @klass.send(:expand_hash_conditions_for_aggregates, args.first) + 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) else - args.first + opts end - - conditions end private |