Mr. Carl Fri Nov 02 21:08:25 -0400 2012

Subject: Validate only dirty varables on update

You may want to edit Model/Validation so the validation is only run on dirty variables vs. whole model. Or have method that does only dirty variables, which maybe better idea. (I'm using php-activerecord-20120801).

I can see why whole ( dirty and non-dirty variables) model validation on update is good idea in case the validation rules have change. However, in some case it's good idea to only to validation dirty variables.

For example in one of my problem I have list of item which are order by a number (non-pk). If I remove the item from the list I need to reorder the list. In this example after deleting the item I run after_destroy function that reorder the list. To update the order number all I would need is pk, and order number of the items vs loading the whole model information for each item. I'm editing the items inside the model without using user input so I could get way without validate it, which I'm currently doing.

Other better example is you only updating a single variable in user model. The user model has a lot of information which you only need to update small variable. If you need to update list loading all that information for each user model would slow things down.

Jeremy Mulvihill Sat Mar 23 11:59:35 -0400 2013

Okay so how is it done? I have the same problem.