title: How to ignore all blank form fields when updating a model?
body: <p>I have the following model:</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    validates :password, presence: true, length: { in: 6..255 }
  end
  </code></pre>
  
  <p>... and a standard controller and view. The user form does not present the current password. I want to avoid this blank password being set on the model. I only want to update the password when it is non-blank.</p>
  
  <p>I tried:</p>
  
  <pre><code>model_params = params.reject {|k, v| v == ""}
  @model.update!(model_params)
  </code></pre>
  
  <p>But it did not work, can not be skip model validates.</p>
  
  <p>When I call <code>model.update!</code> Rails reports:</p>
  
  <blockquote>
  <pre><code>Validation failed:  Password can't be blank, Password is too short (minimum is 6 characters)
  </code></pre>
  </blockquote>