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 eccaaca907
commit c15433af3f
2 changed files with 13 additions and 2 deletions

View File

@@ -82,7 +82,7 @@ module Spree
source_params = params.delete(:payment_source)[params[:payment][:payment_method_id]]
params[:payment][:source_attributes] = source_params
end
params[:payment]
params.require(:payment).permit(:amount, :payment_method_id, :source_attributes)
end
def load_data

View File

@@ -89,7 +89,7 @@ module Spree
@update_children = true
end
if @taxon.update_attributes(params[:taxon])
if @taxon.update_attributes(taxon_params)
flash[:success] = flash_message_for(@taxon, :successfully_updated)
end
@@ -113,6 +113,17 @@ module Spree
@taxon.destroy
respond_with(@taxon) { |format| format.json { render json: '' } }
end
private
def taxon_params
params.require(:taxon).permit(permitted_params)
end
def permitted_params
[:name, :parent_id, :position, :icon, :description, :permalink,
:taxonomy_id, :meta_description, :meta_keywords, :meta_title]
end
end
end
end