mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Handle strong params in credit card controllers
This commit is contained in:
@@ -26,7 +26,7 @@ module Spree
|
||||
|
||||
authorize! :update, @credit_card
|
||||
|
||||
if @credit_card.update_attributes(params[:credit_card])
|
||||
if @credit_card.update_attributes(credit_card_params)
|
||||
render json: @credit_card, serializer: ::Api::CreditCardSerializer, status: :ok
|
||||
else
|
||||
update_failed
|
||||
@@ -96,5 +96,9 @@ module Spree
|
||||
def update_failed
|
||||
render json: { flash: { error: t(:card_could_not_be_updated) } }, status: :bad_request
|
||||
end
|
||||
|
||||
def credit_card_params
|
||||
params.require(:credit_card).permit(:is_default, :year, :month)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user