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?
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