Validates_presence_of validating twice?

I’m getting some weird behavior in one of my models. I have a model
defined something like this

class User < ActiveRecord::Base
attr_accessor :password

validates_presence_of :password
end

If I validate the model without specifying a password, I get [“can’t be
blank”, “can’t be blank”] for :password instead of just one “cant’t be
blank”. If I comment out the validates_presence_of statement, then no
errors. So it doesn’t seem like it’s being defined elsewhere(though a
plugin or some such). Any idea what might be going on here?

Thanks,
Steve

When you call the page, do you use a request.post?

On 10/17/07, Steve [email protected] wrote:

If I validate the model without specifying a password, I get [“can’t be
blank”, “can’t be blank”] for :password instead of just one “cant’t be
blank”. If I comment out the validates_presence_of statement, then no
errors. So it doesn’t seem like it’s being defined elsewhere(though a
plugin or some such). Any idea what might be going on here?

This can happen if the model file gets loaded twice. Do you have

require ‘user’

somewhere in your code?

On Wed, 17 Oct 2007 16:28:18 -0400, Bob S. wrote:

This can happen if the model file gets loaded twice. Do you have

require ‘user’

somewhere in your code?

Yes, I had a “load” statement in there that was causing this to happen.
Thanks.