title: ActiveRecord bug? Or am I getting it wrong? (validates_presence_of if)
body: <p>Ok:</p>
  
  <pre><code>User
      attr_accessible :name, :email, :email_confirmation
  
      validates_presence_of :email_confirmation if :email_changed?
  </code></pre>
  
  <p>What happens in the following situation:</p>
  
  <pre><code>u = User.find 1
  u.name = 'Fonzi'
  u.name_changed? # =&gt; true
  u.email_changed? # =&gt; false
  u.valid? # =&gt; false : email_confirmation is required
  </code></pre>
  
  <p>Basically, if I change if to unless the validates works as expected, won't validate if the email has not changed, will validate if the email changed. I thought the IF indicates "run this validation if the following function returns true. Seems to work backwards!? Am I just getting it wrong?</p>