title: Update params in Ruby on Rails controller
body: <p>I have a controller in which I want to update the value of one of the parameters before the update so that the update is carried out in the same save to the database. Unfortunately, the following code does not set <code>z</code> in the database:</p>
  
  <pre><code>if @model.x == "YES" &amp;&amp; @model.z.blank? 
     model_params[:z] = Time.now
  end
  @model.update_attributes(model_params) 
  
  def model_params
    params.require(:model).permit(:x, :y, :z)
  end
  </code></pre>