CultivateLabs / storytime

Storytime is a Rails 4+ CMS and blogging engine, with a core focus on content. It is built and maintained by @cultivatelabs
MIT License
752 stars 81 forks source link

Custom field with storytime_post_param_additions doesn't work #191

Closed harin closed 9 years ago

harin commented 9 years ago

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 9 years ago

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