mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Get rid of Relation#order_clauses
This commit is contained in:
parent
8ba2902dd4
commit
8bb5274648
2 changed files with 9 additions and 13 deletions
|
@ -50,14 +50,14 @@ module ActiveRecord
|
|||
@records = if find_with_associations
|
||||
begin
|
||||
options = {
|
||||
:select => @select_values.any? ? @select_values.join(", ") : nil,
|
||||
:select => @select_values.join(", "),
|
||||
:joins => arel.joins(arel),
|
||||
:group => @group_values.any? ? @group_values.join(", ") : nil,
|
||||
:order => order_clause,
|
||||
:group => @group_values.join(", "),
|
||||
:order => @order_values.join(', '),
|
||||
:conditions => where_clause,
|
||||
:limit => arel.taken,
|
||||
:offset => arel.skipped,
|
||||
:from => (arel.send(:from_clauses) if arel.send(:sources).present?)
|
||||
:limit => @limit_value,
|
||||
:offset => @offset_value,
|
||||
:from => @from_value
|
||||
}
|
||||
|
||||
including = (@eager_load_values + @includes_values).uniq
|
||||
|
@ -185,10 +185,6 @@ module ActiveRecord
|
|||
arel.send(:where_clauses).join(join_string)
|
||||
end
|
||||
|
||||
def order_clause
|
||||
@order_clause ||= arel.send(:order_clauses).join(', ')
|
||||
end
|
||||
|
||||
def references_eager_loaded_tables?
|
||||
joined_tables = (tables_in_string(arel.joins(arel)) + [table.name, table.table_alias]).compact.uniq
|
||||
(tables_in_string(to_sql) - joined_tables).any?
|
||||
|
|
|
@ -608,7 +608,7 @@ class DefaultScopingTest < ActiveRecord::TestCase
|
|||
|
||||
def test_default_scoping_with_threads
|
||||
2.times do
|
||||
Thread.new { assert_equal 'salary DESC', DeveloperOrderedBySalary.scoped.send(:order_clause) }.join
|
||||
Thread.new { assert_equal ['salary DESC'], DeveloperOrderedBySalary.scoped.order_values }.join
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -618,10 +618,10 @@ class DefaultScopingTest < ActiveRecord::TestCase
|
|||
klass.send :default_scope, {}
|
||||
|
||||
# Scopes added on children should append to parent scope
|
||||
assert klass.scoped.send(:order_clause).blank?
|
||||
assert klass.scoped.order_values.blank?
|
||||
|
||||
# Parent should still have the original scope
|
||||
assert_equal 'salary DESC', DeveloperOrderedBySalary.scoped.send(:order_clause)
|
||||
assert_equal ['salary DESC'], DeveloperOrderedBySalary.scoped.order_values
|
||||
end
|
||||
|
||||
def test_method_scope
|
||||
|
|
Loading…
Reference in a new issue