mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
order query is already a string, no need to to_s
This commit is contained in:
parent
b8634dddab
commit
41c1aa607d
1 changed files with 2 additions and 2 deletions
|
@ -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)$/)
|
||||
|
|
Loading…
Reference in a new issue