title: Rails 4 Combine update_attributes(params.permit) with fix variable
body: <p>Through an API my models get updated with this call:</p>
  
  <pre><code>if @user.update_attributes(params.permit(:name, :phone, ...)
      format ...
  else 
      format ...
  end 
  </code></pre>
  
  <p>This is nested in another if query and based on the result i would like to set a another variable in the same model. So far  i do it with</p>
  
  <pre><code>@user.update_attributes(variable: :value)
  </code></pre>
  
  <p>But this issues two writes on my table, which i am pretty sure can be 
  merged into one, but i don't know how.
  This is the whole block:</p>
  
  <pre><code>if test_for_something
     @user.update_attributes(variable: :value)
     if @user.update_attributes(params.permit(:name, :phone, ...)
       format ...
     else 
       format ...
     end 
  </code></pre>
  
  <p>Thanks all in advance!</p>