diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-09-04 09:56:55 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-09-04 09:56:55 +0100 |
commit | ef7e60f008aab5b6390f44ae8f5923edcdf470b8 (patch) | |
tree | 411cf98eba2a77fcfc90029568eb928782156ec4 /activerecord/lib/active_record | |
parent | 98c3fd87e2879ab2fb9c8cd31afacae5e7110325 (diff) | |
download | rails-ef7e60f008aab5b6390f44ae8f5923edcdf470b8.tar.gz rails-ef7e60f008aab5b6390f44ae8f5923edcdf470b8.tar.bz2 rails-ef7e60f008aab5b6390f44ae8f5923edcdf470b8.zip |
Revert "Fixes bug in ActiveRecord::QueryMethods, #1697"
This reverts commit 0df27c98d982ec87d2fb48cfda82694eb267993e.
Reverted due to failing test, see #2845.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 355540782f..7eda9ad8e8 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -305,8 +305,10 @@ module ActiveRecord when Arel::Nodes::Ordering o.reverse when String, Symbol - s = o.to_s.gsub(/\s((desc)|(asc))\s*(,|\Z)/i) { |m| " #{$2 ? 'ASC' : 'DESC'}#{$4}" } - s.match(/\s(de|a)sc\Z/i) ? s : s.concat(" DESC") + o.to_s.split(',').collect do |s| + s.strip! + s.gsub!(/\sasc\Z/i, ' DESC') || s.gsub!(/\sdesc\Z/i, ' ASC') || s.concat(' DESC') + end else o end |