
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
-
Sam Smoot January 5th, 2008 @ 11:26 AM
- State changed from new to invalid
Please feel free to add to this discussion: http://wm.lighthouseapp.com/proj...
I'm not sure that the execution order you assume is how we in fact do it, but I could be wrong, didn't bother to look it up. ;-)
-
Kevin Bullock January 5th, 2008 @ 06:07 PM
I think you meant to link to #74 where the validation discussion is happening?
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.
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
Tags
Referenced by
-
123 auto_validations? Please feel free to add to this discussion: http://wm.li...