small medium large xlarge

31 Jul 2008, 18:01
Dave Thomas (366 posts)


First a point about forum etiquette. Of course you can post questions. But you also seem to feel entitled to answers. This is not the case. People will do what they can to help, but you can’t demand it of them.

Other readers chip in. So do authors, if they have the time.

On to your question. Ask yourself what’s being validated? Is it user input, or is it the model. If the latter, then it should be the model field that’s tested. Consider the case of an edit screen that lets a user update their contact details but not their password. The data from the user would not contain the two password fields. If they were being validated, then the update would fail.

Always validate the canonical data. Then validate the ethereal if appropriate.

—Dave Thomas

31 Jul 2008, 22:47
Sam Ruby (633 posts)


errors.add(:password, "missing") if hashed_password.blank?
01 Aug 2008, 02:31
Dave Thomas (366 posts)


These forums primarily allow readers to help other readers. The reality is, with tens of thousands of book owners, providing support from the authors to every reader’s question just wouldn’t be practical.

Feel free to post questions. But don’t feel cheated if no one answers for three days. It just doesn’t work that way.


You must be logged in to comment