diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-03-05 10:45:37 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-03-05 10:45:37 +0100 |
commit | b74eed58b228b49c5298cf0df9c6890d0b8a4ab5 (patch) | |
tree | ec706c09f9c946d631e67bd4dc91d10330f58839 | |
parent | f6aeb8b1a3687c8523e4a56309fe3736011b2935 (diff) | |
download | rails-b74eed58b228b49c5298cf0df9c6890d0b8a4ab5.tar.gz rails-b74eed58b228b49c5298cf0df9c6890d0b8a4ab5.tar.bz2 rails-b74eed58b228b49c5298cf0df9c6890d0b8a4ab5.zip |
get rid of intermediate arrays.
origin: https://github.com/rails/rails/commit/f6aeb8b1a3687c8523e4a56309fe3736011b2935#commitcomment-5569649
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index f694a901f4..8c005a7222 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -1034,8 +1034,9 @@ module ActiveRecord 'asc', 'desc', 'ASC', 'DESC'] # :nodoc: def validate_order_args(args) - args.grep(Hash) do |h| - h.values.each do |value| + args.each do |arg| + next unless arg.is_a?(Hash) + arg.each do |_key, value| raise ArgumentError, "Direction \"#{value}\" is invalid. Valid " \ "directions are: #{VALID_DIRECTIONS.inspect}" unless VALID_DIRECTIONS.include?(value) end |