From c3ec0dbdd4279cb9273194a8ed8f8d9dcdf54816 Mon Sep 17 00:00:00 2001 From: John Gesimondo Date: Sun, 26 May 2013 20:27:49 -0700 Subject: [PATCH] use grep over select for consistency and efficiency pass block directly to grep --- activerecord/lib/active_record/relation/query_methods.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index d020f1ba52..0292d363d4 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -1015,7 +1015,7 @@ module ActiveRecord end def validate_order_args(args) - args.select { |a| Hash === a }.each do |h| + args.grep(Hash) do |h| unless (h.values - [:asc, :desc]).empty? raise ArgumentError, 'Direction should be :asc or :desc' end