mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Update Arel usage for rails/arel#98fc259
`where_sql` now requires that we pass it an engine. None of the manager classes take an engine in their constructor.
This commit is contained in:
parent
b5242b6f95
commit
a975407a0a
4 changed files with 8 additions and 8 deletions
|
@ -165,7 +165,7 @@ module ActiveRecord
|
|||
|
||||
arel = scope.arel
|
||||
|
||||
stmt = Arel::DeleteManager.new arel.engine
|
||||
stmt = Arel::DeleteManager.new
|
||||
stmt.from scope.klass.arel_table
|
||||
stmt.wheres = arel.constraints
|
||||
|
||||
|
|
|
@ -327,7 +327,7 @@ module ActiveRecord
|
|||
def update_all(updates)
|
||||
raise ArgumentError, "Empty list of attributes to change" if updates.blank?
|
||||
|
||||
stmt = Arel::UpdateManager.new(arel.engine)
|
||||
stmt = Arel::UpdateManager.new
|
||||
|
||||
stmt.set Arel.sql(@klass.send(:sanitize_sql_for_assignment, updates))
|
||||
stmt.table(table)
|
||||
|
@ -465,7 +465,7 @@ module ActiveRecord
|
|||
if conditions
|
||||
where(conditions).delete_all
|
||||
else
|
||||
stmt = Arel::DeleteManager.new(arel.engine)
|
||||
stmt = Arel::DeleteManager.new
|
||||
stmt.from(table)
|
||||
|
||||
if joins_values.any?
|
||||
|
|
|
@ -108,7 +108,7 @@ module ActiveRecord
|
|||
# Same as +take+ but raises <tt>ActiveRecord::RecordNotFound</tt> if no record
|
||||
# is found. Note that <tt>take!</tt> accepts no arguments.
|
||||
def take!
|
||||
take or raise RecordNotFound.new("Couldn't find #{@klass.name} with [#{arel.where_sql}]")
|
||||
take or raise RecordNotFound.new("Couldn't find #{@klass.name} with [#{arel.where_sql(@klass.arel_engine)}]")
|
||||
end
|
||||
|
||||
# Find the first record (or first N records if a parameter is supplied).
|
||||
|
@ -176,7 +176,7 @@ module ActiveRecord
|
|||
# Same as +last+ but raises <tt>ActiveRecord::RecordNotFound</tt> if no record
|
||||
# is found. Note that <tt>last!</tt> accepts no arguments.
|
||||
def last!
|
||||
last or raise RecordNotFound.new("Couldn't find #{@klass.name} with [#{arel.where_sql}]")
|
||||
last or raise RecordNotFound.new("Couldn't find #{@klass.name} with [#{arel.where_sql(@klass.arel_engine)}]")
|
||||
end
|
||||
|
||||
# Find the second record.
|
||||
|
@ -323,7 +323,7 @@ module ActiveRecord
|
|||
# the expected number of results should be provided in the +expected_size+
|
||||
# argument.
|
||||
def raise_record_not_found_exception!(ids, result_size, expected_size) #:nodoc:
|
||||
conditions = arel.where_sql
|
||||
conditions = arel.where_sql(@klass.arel_engine)
|
||||
conditions = " [#{conditions}]" if conditions
|
||||
|
||||
if Array(ids).size == 1
|
||||
|
@ -498,7 +498,7 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
def find_nth!(index)
|
||||
find_nth(index, offset_index) or raise RecordNotFound.new("Couldn't find #{@klass.name} with [#{arel.where_sql}]")
|
||||
find_nth(index, offset_index) or raise RecordNotFound.new("Couldn't find #{@klass.name} with [#{arel.where_sql(@klass.arel_engine)}]")
|
||||
end
|
||||
|
||||
def find_nth_with_limit(offset, limit)
|
||||
|
|
|
@ -858,7 +858,7 @@ module ActiveRecord
|
|||
private
|
||||
|
||||
def build_arel
|
||||
arel = Arel::SelectManager.new(klass.arel_engine, table)
|
||||
arel = Arel::SelectManager.new(table)
|
||||
|
||||
build_joins(arel, joins_values.flatten) unless joins_values.empty?
|
||||
|
||||
|
|
Loading…
Reference in a new issue