1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

use grep over select for consistency and efficiency

pass block directly to grep
This commit is contained in:
John Gesimondo 2013-05-26 20:27:49 -07:00
parent 50e89373c5
commit c3ec0dbdd4

View file

@ -1015,7 +1015,7 @@ module ActiveRecord
end end
def validate_order_args(args) def validate_order_args(args)
args.select { |a| Hash === a }.each do |h| args.grep(Hash) do |h|
unless (h.values - [:asc, :desc]).empty? unless (h.values - [:asc, :desc]).empty?
raise ArgumentError, 'Direction should be :asc or :desc' raise ArgumentError, 'Direction should be :asc or :desc'
end end