Rails 5: Merging parameters in view - where to permit them?

Viewed 3147

what is the new way in Rails 5 to merge actual page query strings to link with a new one?

Let's assume I have page http://localhost:3000?type=a and I want to add another query param to the link on page:

<%= link_to root_path(params.merge(tech: "b")) do %>

but I get: unable to convert unpermitted parameters to hash. Where I should permit the params?
I tried to do it in before_action filter, but it seems to be too late.

Thanks

EDIT:

My controller:

class HomeController < ApplicationController
  before_action :permit_params

  ...

  private

  def permit_params
    params.permit(:tech, :type)
  end
end
1 Answers
Related