title: rails 4 - update user object and bypass model validations
body: <p>I'm following Micahel Hartl's Rails tutorial to build a sample app. I've tried to explore a bit and add some different things-- so in the Users table I've added an <code>account_balance</code> column.</p>
  
  <p>The problem is that the <code>User</code> model has a bunch of validations built in: </p>
  
  <pre><code>validates :name, presence: true, length: { maximum: 50 }
  validates :username, presence: true, length: { maximum: 50 }
  VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-]+(?:\.[a-z\d\-]+)*\.[a-z]+\z/i
  validates :email, presence:   true,
                    format:     { with: VALID_EMAIL_REGEX },
                    uniqueness: { case_sensitive: false }
  has_secure_password
  validates :password, length: { minimum: 6 }
  </code></pre>
  
  <p>I have another function that attempts to update just the <code>account_balance</code> by doing:</p>
  
  <pre><code>buyer   = User.find(t.buyer_id)
  buyer.account_balance -= item_price 
  buyer.save
  </code></pre>
  
  <p>This fails to save. When I ran it in the rails console, it returned the following, which means nothing to me:</p>
  
  <pre><code>irb(main):055:0&gt; u = User.first
    User Load (0.5ms)  SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
  =&gt; # all the user info here
  irb(main):056:0&gt; u.account_balance = 10.00
  =&gt; 10.0
  irb(main):057:0&gt; u.save
     (0.2ms)  begin transaction
    User Exists (0.3ms)  SELECT 1 AS one FROM "users" WHERE (LOWER("users"."email") = LOWER('test@example.com') AND "users"."id" != 1) LIMIT 1
     (0.1ms)  rollback transaction
  =&gt; false
  </code></pre>
  
  <p>I am guessing that the uniqueness constraint on the email is being violated, but I don't know why this would happen on an update?</p>