Skip to content

Instantly share code, notes, and snippets.

@senny
Created March 5, 2014 09:05
Show Gist options
  • Save senny/9363719 to your computer and use it in GitHub Desktop.
Save senny/9363719 to your computer and use it in GitHub Desktop.
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb
index a22849f..021c50d 100644
--- a/activerecord/lib/active_record/relation/query_methods.rb
+++ b/activerecord/lib/active_record/relation/query_methods.rb
@@ -1030,13 +1030,14 @@ module ActiveRecord
arel.order(*orders) unless orders.empty?
end
- VALID_DIRECTIONS = [:asc, :desc, 'asc', 'desc'] # :nodoc:
+ VALID_DIRECTIONS = [:asc, :desc, :ASC, :DESC,
+ 'asc', 'desc', 'ASC', 'DESC'] # :nodoc:
def validate_order_args(args)
args.grep(Hash) do |h|
- h.values.map(&:downcase).each do |value|
+ h.values.each do |value|
raise ArgumentError, "Direction '#{value}' is invalid. Valid " \
- "directions are asc and desc." unless VALID_DIRECTIONS.include?(value)
+ "directions are: #{VALID_DIRECTIONS.inspect}" unless VALID_DIRECTIONS.include?(value)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment