Permalink
Browse files

use grep over select for consistency and efficiency

pass block directly to grep
  • Loading branch information...
jmondo committed May 27, 2013
1 parent 50e8937 commit c3ec0dbdd4279cb9273194a8ed8f8d9dcdf54816
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/relation/query_methods.rb
@@ -1015,7 +1015,7 @@ def build_order(arel)
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

0 comments on commit c3ec0db

Please sign in to comment.