aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Chen Songyong <aquajach@gmail.com>2016-07-29 22:29:21 +0800
committerJack Chen Songyong <aquajach@gmail.com>2016-07-29 22:29:21 +0800
commitd929a218c47b7a5ffc3f8989676a99edb992e2aa (patch)
tree2c88eaeff30887ec1aeee5f89325d5b3b172ba27
parentc0eb542e57fe6eaa959218c1a7026e53673ba0cb (diff)
downloadrails-d929a218c47b7a5ffc3f8989676a99edb992e2aa.tar.gz
rails-d929a218c47b7a5ffc3f8989676a99edb992e2aa.tar.bz2
rails-d929a218c47b7a5ffc3f8989676a99edb992e2aa.zip
check if order contains comma first in does_not_support_reverse?
-rw-r--r--activerecord/lib/active_record/relation/query_methods.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb
index 97acf26516..099bbe1292 100644
--- a/activerecord/lib/active_record/relation/query_methods.rb
+++ b/activerecord/lib/active_record/relation/query_methods.rb
@@ -1137,7 +1137,7 @@ module ActiveRecord
def does_not_support_reverse?(order)
# Uses SQL function with multiple arguments.
- order.split(',').find { |section| section.count('(') != section.count(')')} ||
+ (order.include?(',') && order.split(',').find { |section| section.count('(') != section.count(')')}) ||
# Uses "nulls first" like construction.
/nulls (first|last)\Z/i.match?(order)
end