CultivateLabs/storytime

Custom field with storytime_post_param_additions doesn't work

Closed this issue · 1 comments

harin commented

Putting it in the applicationcontroller doesn't work. So instead I did the following. However, when I check the post_params, it still doesn't include my params eventhough params has it. I notice the post_params method append the attrs provided by storytime_post_param_additions instead of concat.

Storytime::Dashboard::DashboardController.class_eval do
  before_action :parse_input, only: [:update]

  def storytime_post_param_additions
    attrs = [{:spree_product_ids => []}]
    attrs
  end

  def parse_input
    params[:spree_product_ids] = params[:spree_product_ids].split(',').map(&:to_i)
  end
end
harin commented

works now. turns out I named the input wrong, as a result the params was filtered out by params.require