mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Bring some strong parameters code from spree to our Spree controllers
This code comes from spree commit fbc2d150f6
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user