mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-14 04:04:23 +00:00
Merge pull request #6654 from Matt-Yorkley/update-without-callbacks
Remove #update_attributes_without_callbacks
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 } }
|
||||
|
||||
@@ -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)] }
|
||||
|
||||
Reference in New Issue
Block a user