diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-09-30 20:17:41 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2018-10-01 11:53:15 +0900 |
commit | 6d40d2d3d1f3766551e74607a718a5ec97963bbf (patch) | |
tree | 8c387da07c7fc7c14c6a09072fda46173e6d71a0 /activerecord/lib/active_record | |
parent | 322c5704e5ab8cc9bc3cfffecd3b06641d95f2b4 (diff) | |
download | rails-6d40d2d3d1f3766551e74607a718a5ec97963bbf.tar.gz rails-6d40d2d3d1f3766551e74607a718a5ec97963bbf.tar.bz2 rails-6d40d2d3d1f3766551e74607a718a5ec97963bbf.zip |
Handle UPDATE/DELETE with OFFSET in Arel
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 5bad5bfcc2..d8cff30b88 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -356,11 +356,12 @@ module ActiveRecord stmt.set Arel.sql(klass.sanitize_sql_for_assignment(updates, table.name)) end - if has_join_values? || offset_value + if has_join_values? @klass.connection.join_to_update(stmt, arel, arel_attribute(primary_key)) else stmt.key = arel_attribute(primary_key) stmt.take(arel.limit) + stmt.offset(arel.offset) stmt.order(*arel.orders) stmt.wheres = arel.constraints end @@ -484,11 +485,12 @@ module ActiveRecord stmt = Arel::DeleteManager.new stmt.from(table) - if has_join_values? || offset_value + if has_join_values? @klass.connection.join_to_delete(stmt, arel, arel_attribute(primary_key)) else stmt.key = arel_attribute(primary_key) stmt.take(arel.limit) + stmt.offset(arel.offset) stmt.order(*arel.orders) stmt.wheres = arel.constraints end |