I want to be able to protect the email field of the account from updating, but not when the account entry is created first.
I tried the following:
validate :email_is_unchanged, :on => :update def email_is_unchanged errors.add :email, "can only be changed through confirmation" if email_changed? end
but when I try to do the following (with an existing entry in the database):
a = Account.first
a.update_attributes ({: email => " Email@example.com ")}
Returns true, but does not save the record. Error checking indicates that an error has been added from the verification method.
Is there a better way to do this?
source share