title: Sequence of commands to determine param values based on other params
body: <p>A controller action needs to calculate values based on some params, the result of which needs to be updated in the same action</p>
  
  <pre><code>  def update
      calculate_weight_volume
      authorize @itme
      @itme.update(itme_params)
  </code></pre>
  
  <p>the method</p>
  
  <pre><code>def calculate_weight_volume
    if !params[:itme][:width].nil? &amp;&amp; !params[:itme][:length].nil? &amp;&amp; !params[:itme][:height].nil? &amp;&amp; !params[:itme][:weight].nil?
      @weight_volume = (params[:itme][:width].to_d + 1) * (params[:itme][:length].to_d + 1) * (params[:itme][:height].to_d + 1) / conversion_factor
      if @weight_volume &gt; params[:itme][:weight].to_d
        params[:itme][:weight_volume] = @weight_volume
      else
        params[:itme][:weight_volume] = @itme
      end
    end
  end
  </code></pre>
  
  <p>is not being calculated with the params, but with the record's saved attributes.</p>
  
  <p>Aside from the fact rails4 is using attributes for the calculations, it is obvious that the call to method <code>calculate_weight_volume</code> is being ignored before the update_params kicks in.</p>
  
  <p>Why is that and how can this be overcome?</p>