diff options
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index d4c5c85594..9a882ba01a 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -169,6 +169,7 @@ module ActiveRecord # Apply limit and order only if they're both present if @limit_value.present? == @order_values.present? stmt = arel.compile_update(Arel::SqlLiteral.new(@klass.send(:sanitize_sql_for_assignment, updates))) + stmt.key = @klass.arel_table[@klass.primary_key] @klass.connection.update stmt.to_sql else except(:limit, :order).update_all(updates) |