Permalink
Browse files

use blank? instead of present?, mark SQL literals as SQL literals

  • Loading branch information...
1 parent 3dc9880 commit 9ba46cf15aa2884cf2293bcef4cee452d658fecf @tenderlove tenderlove committed Aug 25, 2010
Showing with 5 additions and 5 deletions.
  1. +5 −5 activerecord/lib/active_record/relation/query_methods.rb
@@ -99,11 +99,11 @@ def reverse_order
order_clause = arel.order_clauses.join(', ')
relation = except(:order)
- if order_clause.present?
- relation.order(reverse_sql_order(order_clause))
- else
- relation.order("#{@klass.table_name}.#{@klass.primary_key} DESC")
- end
+ order = order_clause.blank? ?
+ "#{@klass.table_name}.#{@klass.primary_key} DESC" :
+ reverse_sql_order(order_clause)
+
+ relation.order Arel::SqlLiteral.new order
end
def arel

0 comments on commit 9ba46cf

Please sign in to comment.