#1363 suggestion
Kevin Watt

validations should only be run for loaded lazy attributes

Reported by Kevin Watt | July 15th, 2010 @ 06:34 PM

Currently when a validation runs, it gets all the values from the database, then never saves them because of course they're not dirty.

I found this strange, so thought I'd submit a ticket. I expected that it would skip validation on lazy attributes of non-new rows. The current method may be intentional, I don't know.

It would be less frustrating if lazy attributes defaulted to being in the same group, or had some way to know all were being requested and getting them all. My table has 10 text fields, so issues 10 select queries each time I update a row.

Comments and changes to this ticket

  • Kevin Watt

    Kevin Watt July 19th, 2010 @ 01:38 AM

    After thinking about this more, I think this should be closed. Validations should run on all attributes. One can use save!/update! if you want to skip them for some reason... Besides, its (probably) only one row one is updating, and thats just not a huge deal. At least once the lazy groups gets fixed it won't be :)

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) July 28th, 2010 @ 12:54 AM

    • State changed from “new” to “suggestion”

    There is a future optimization where we'll specify whether validations are per-attribute or not. The ones that are per-attribute will only execute if the attribute is dirty.

    There are some validations, like the custom ones, that we have to run everytime, but simple stuff like length, required, etc can probably be skipped (when the value is clean) without any negative side effects.

    Although the main reason this hasn't been done is that the simple validates are really fast. They are typically not the bottleneck, aside from uniqueness checking which is generally one of the more expensive built-in validations.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) March 23rd, 2011 @ 11:18 PM

    • Assigned user set to “Jordan Ritter”

    @Jordan: Is this ticket resolved by the changes you made for the 1.1 release?

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 »