diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-08-03 09:16:01 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-08-03 09:16:01 -0700 |
commit | 41c1aa607dc9633c05e7946b7d2cf6f5c6954317 (patch) | |
tree | 09db258175c7118904178e232837332040c6998f /activerecord/lib/active_record/relation/query_methods.rb | |
parent | b8634dddabb84f74a1e5314ea1f26833a6feebc4 (diff) | |
download | rails-41c1aa607dc9633c05e7946b7d2cf6f5c6954317.tar.gz rails-41c1aa607dc9633c05e7946b7d2cf6f5c6954317.tar.bz2 rails-41c1aa607dc9633c05e7946b7d2cf6f5c6954317.zip |
order query is already a string, no need to to_s
Diffstat (limited to 'activerecord/lib/active_record/relation/query_methods.rb')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index a92d180442..5ef00206dd 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -95,7 +95,7 @@ module ActiveRecord order_clause = arel.send(:order_clauses).join(', ') relation = except(:order) - if order_clause.present? + unless order_clauses.blank? relation.order(reverse_sql_order(order_clause)) else relation.order("#{@klass.table_name}.#{@klass.primary_key} DESC") @@ -238,7 +238,7 @@ module ActiveRecord end def reverse_sql_order(order_query) - order_query.to_s.split(/,/).each { |s| + order_query.split(',').each { |s| if s.match(/\s(asc|ASC)$/) s.gsub!(/\s(asc|ASC)$/, ' DESC') elsif s.match(/\s(desc|DESC)$/) |