title: Overwrite Params in Rails
body: <p>One of my functions creates new agencies. The params come from a form that is submitted and in my controller I use:</p>
  
  <pre><code>agency_params
        params.require(:agency).permit(:name, :cnpj, :country, :state, :city, :phone, :email, :platform_id)
  end
  </code></pre>
  
  <p>In some cases (depending on the user role) I don't want to allow any platform_id but just a specific one.</p>
  
  <p>So my idea was:</p>
  
  <pre><code>def agency_params
        params.require(:agency).permit(:name, :cnpj, :country, :state, :city, :phone, :email, :platform_id)
  
        if current_user.platform
          params[:platform_id] = current_user.platform.id
        end
      end
  </code></pre>
  
  <p>But this does not seem to work. How could I do that? Is the controller the right place, or better in the model?</p>
  
  <p>Thanks!</p>