Bring some strong parameters code from spree to our Spree controllers

This code comes from spree commit fbc2d150f6
This commit is contained in:
Luis Ramos
2020-02-22 17:41:45 +00:00
parent fec5e1d84e
commit a9a92e11e2

View File

@@ -18,7 +18,7 @@ module Spree
end
def update
if @order.update_attributes(params[:order])
if @order.update_attributes(order_params)
if params[:guest_checkout] == "false"
@order.associate_user!(Spree.user_class.find_by(email: @order.email))
end
@@ -41,6 +41,15 @@ module Spree
private
def order_params
params.require(:order).permit(
:email,
:use_billing,
:bill_address_attributes => permitted_address_attributes,
:ship_address_attributes => permitted_address_attributes
)
end
def load_order
@order = Order.find_by_number!(params[:order_id], include: :adjustments)
end