Created
March 5, 2014 09:05
-
-
Save senny/9363719 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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