#123 invalid
Dae San Hwang

auto_validations?

Reported by Dae San Hwang | January 3rd, 2008 @ 12:39 AM

I've come across a featured called "auto_validations" which automatically add "validates_presence_of" validation for all columns declared ":nullable => false".

While this seems to be in line with the principle of DRY, I don't think it's a good idea. Some properties (salt/salted_password come to mind) are calculated based on other properties when the record is saved. Those properties don't really need validations. Moreover, such calculations are usually put into before_create/before_save callbacks which are called only after validations are run.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Referenced by

Pages