Permalink
Browse files

get rid of intermediate arrays.

  • Loading branch information...
1 parent f6aeb8b commit b74eed58b228b49c5298cf0df9c6890d0b8a4ab5 @senny senny committed Mar 5, 2014
Showing with 3 additions and 2 deletions.
  1. +3 −2 activerecord/lib/active_record/relation/query_methods.rb
@@ -1034,8 +1034,9 @@ def build_order(arel)
'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

0 comments on commit b74eed5

Please sign in to comment.