diff options
author | Jack Chen Songyong <aquajach@gmail.com> | 2016-07-29 22:29:21 +0800 |
---|---|---|
committer | Jack Chen Songyong <aquajach@gmail.com> | 2016-07-29 22:29:21 +0800 |
commit | d929a218c47b7a5ffc3f8989676a99edb992e2aa (patch) | |
tree | 2c88eaeff30887ec1aeee5f89325d5b3b172ba27 /activerecord | |
parent | c0eb542e57fe6eaa959218c1a7026e53673ba0cb (diff) | |
download | rails-d929a218c47b7a5ffc3f8989676a99edb992e2aa.tar.gz rails-d929a218c47b7a5ffc3f8989676a99edb992e2aa.tar.bz2 rails-d929a218c47b7a5ffc3f8989676a99edb992e2aa.zip |
check if order contains comma first in does_not_support_reverse?
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 2 |
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 |