Merge pull request #6654 from Matt-Yorkley/update-without-callbacks

Remove #update_attributes_without_callbacks
This commit is contained in:
Pau Pérez Fabregat
2021-01-15 12:24:42 +01:00
committed by GitHub
4 changed files with 3 additions and 10 deletions

View File

@@ -765,13 +765,6 @@ module Spree
address
end
# Update attributes of a record in the database without callbacks, validations etc.
# This was originally an extension to ActiveRecord in Spree but only used for Spree::Order
def update_attributes_without_callbacks(attributes)
assign_attributes(attributes)
Spree::Order.where(id: id).update_all(attributes)
end
private
def process_each_payment

View File

@@ -32,7 +32,7 @@ module OrderManagement
# update totals a second time in case updated adjustments have an effect on the total
update_totals
order.update_attributes_without_callbacks(
order.update_columns(
payment_state: order.payment_state,
shipment_state: order.shipment_state,
item_total: order.item_total,

View File

@@ -5,7 +5,7 @@ require 'spec_helper'
module OrderManagement
module Order
describe Updater do
let(:order) { build(:order) }
let(:order) { create(:order) }
let(:updater) { OrderManagement::Order::Updater.new(order) }
before { allow(order).to receive(:backordered?) { false } }

View File

@@ -3,7 +3,7 @@
require 'spec_helper'
describe Spree::Order do
let(:order) { build(:order) }
let(:order) { create(:order) }
context "#update!" do
let(:line_items) { [build(:line_item, amount: 5)] }