Merge pull request #4833 from Matt-Yorkley/3-0-moar_params

[Spree 2.1] Add strong params to admin/column_preferences_controller.rb
This commit is contained in:
Pau Pérez Fabregat
2020-02-28 10:30:54 +01:00
committed by GitHub

View File

@@ -21,14 +21,18 @@ module Admin
private
def permitted_params
params.permit(:action_name, column_preferences: [:id, :user_id, :action_name, :column_name, :visible])
end
def load_collection
collection_hash = Hash[params[:column_preferences].each_with_index.map { |cp, i| [i, cp] }]
collection_hash.select!{ |_i, cp| cp[:action_name] == params[:action_name] }
collection_hash = Hash[permitted_params[:column_preferences].each_with_index.map { |cp, i| [i, cp] }]
collection_hash.select!{ |_i, cp| cp[:action_name] == permitted_params[:action_name] }
@cp_set = ColumnPreferenceSet.new @column_preferences, collection_attributes: collection_hash
end
def collection
ColumnPreference.where(user_id: spree_current_user, action_name: params[:action_name])
ColumnPreference.where(user_id: spree_current_user, action_name: permitted_params[:action_name])
end
def collection_actions