From b5cdcdf8cb446ea082363901bd7c7157594db7e6 Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Tue, 25 Feb 2020 17:44:07 +0000 Subject: [PATCH] Permit specific params in products controller --- .../spree/admin/products_controller.rb | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/controllers/spree/admin/products_controller.rb b/app/controllers/spree/admin/products_controller.rb index 5bd268ab27..a799336761 100644 --- a/app/controllers/spree/admin/products_controller.rb +++ b/app/controllers/spree/admin/products_controller.rb @@ -166,10 +166,26 @@ module Spree def products_params params.require(:products).map do |product| - product.permit(:id, :name) + product.permit(permitted_product_attributes) end end + def permitted_resource_params + params.require(:product).permit(permitted_product_attributes) + end + + def permitted_product_attributes + [ + :id, :name, :description, :supplier_id, :price, :permalink, + :variant_unit, :variant_unit_scale, :unit_value, :unit_description, + :display_as, :variant_unit_name, + :taxon_ids, :primary_taxon_id, :tax_category_id, :shipping_category_id, + :group_buy, :group_buy_unit_size, + :meta_keywords, :meta_description, :notes, + :inherits_properties, product_properties_attributes: [:id, :property_name, :value] + ] + end + def bulk_index_query(params) params[:filters].to_h.merge(page: params[:page], per_page: params[:per_page]) end