Persist last_ip_address when loading current_order

Leaving the object with unpersisted changes breaks order locking with this error (in various places):

RuntimeError:
        Locking a record with unpersisted changes is not supported. Use `save` to persist the changes, or `reload` to discard them explicitly.
This commit is contained in:
Matt-Yorkley
2021-03-27 14:22:24 +00:00
committed by Andy Brett
parent 76112fcf40
commit 6f8ade52eb

View File

@@ -52,7 +52,7 @@ module Spree
return unless @current_order
@current_order.last_ip_address = ip_address
@current_order.update_columns(last_ip_address: ip_address)
session[:order_id] = @current_order.id
@current_order
end