aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-07-24 14:40:15 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2011-07-24 14:40:15 -0700
commit02691d3516e68b2de5545ec7a495024a377f89fc (patch)
treebc4ff885c9a5e763849096300b804cf516426cb9 /activerecord/lib/active_record
parent12034516e25793370cb92303301cef8249d460ac (diff)
parent77bb0b79f2ed54501046d0e983ef6b10e4bb7b9b (diff)
downloadrails-02691d3516e68b2de5545ec7a495024a377f89fc.tar.gz
rails-02691d3516e68b2de5545ec7a495024a377f89fc.tar.bz2
rails-02691d3516e68b2de5545ec7a495024a377f89fc.zip
Merge pull request #2238 from cesario/order-with-extra-spaces
Ordering with extra spaces was raising a SQL exception
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/relation/query_methods.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb
index 8bd4732c0c..1654ae1eac 100644
--- a/activerecord/lib/active_record/relation/query_methods.rb
+++ b/activerecord/lib/active_record/relation/query_methods.rb
@@ -311,6 +311,7 @@ module ActiveRecord
o.reverse
when String, Symbol
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