diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-08-24 18:29:53 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-08-25 05:17:49 -0700 |
commit | ffdda4ddfb76fec92faea714f03a37baf75351ef (patch) | |
tree | e14edcf14f41bd64b185b3a83636e373da5fe098 /activerecord/lib/active_record | |
parent | b28cafe01a8165f0e9401225b3702a504ea1d8e9 (diff) | |
download | rails-ffdda4ddfb76fec92faea714f03a37baf75351ef.tar.gz rails-ffdda4ddfb76fec92faea714f03a37baf75351ef.tar.bz2 rails-ffdda4ddfb76fec92faea714f03a37baf75351ef.zip |
use blank? instead of present?, mark SQL literals as SQL literals
Conflicts:
activerecord/lib/active_record/relation/query_methods.rb
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 321beadb0c..bb9cdaaefe 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -99,11 +99,11 @@ module ActiveRecord order_clause = arel.order_clauses.join(', ') relation = except(:order) - unless order_clauses.blank? - 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 |