diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-01-04 10:12:40 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-01-04 10:13:22 -0800 |
commit | d22592a05b299c21e30ec8b38890a178dca863b4 (patch) | |
tree | dee6c232c25ee8d100d11aa3e3c16944200a7d99 /activerecord/lib/active_record/relation/query_methods.rb | |
parent | f8df37bc019b9537eff33d8b2a57e7b1c379640f (diff) | |
download | rails-d22592a05b299c21e30ec8b38890a178dca863b4.tar.gz rails-d22592a05b299c21e30ec8b38890a178dca863b4.tar.bz2 rails-d22592a05b299c21e30ec8b38890a178dca863b4.zip |
Merge pull request #4282 from edgecase/order_after_reorder
correctly handle order calls after a reorder
Diffstat (limited to 'activerecord/lib/active_record/relation/query_methods.rb')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index c0fe6836aa..4ff52d777a 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -9,7 +9,7 @@ module ActiveRecord :select_values, :group_values, :order_values, :joins_values, :where_values, :having_values, :bind_values, :limit_value, :offset_value, :lock_value, :readonly_value, :create_with_value, - :from_value, :reorder_value, :reverse_order_value, + :from_value, :reordering_value, :reverse_order_value, :uniq_value def includes(*args) @@ -97,7 +97,8 @@ module ActiveRecord return self if args.blank? relation = clone - relation.reorder_value = args.flatten + relation.reordering_value = true + relation.order_values = args.flatten relation end @@ -263,7 +264,7 @@ module ActiveRecord arel.group(*@group_values.uniq.reject{|g| g.blank?}) unless @group_values.empty? - order = @reorder_value ? @reorder_value : @order_values + order = @order_values order = reverse_sql_order(order) if @reverse_order_value arel.order(*order.uniq.reject{|o| o.blank?}) unless order.empty? |