subsonic / SubSonic-3.0-Templates

T4 Template Project for the peeps
http://subsonic.github.io/
105 stars 46 forks source link

Need default methods for pre-save and validation #27

Open jamesewelch opened 15 years ago

jamesewelch commented 15 years ago

In 2.x, there was a BeforeInsert and BeforeUpdate that was called prior to Insert and Update. This could be used to perform custom audit info or just modify values prior to saving, etc. I think an OnSaving method could easily be added as part of the default template. Also, a validation method was in 2.x that allowed you to validate the data (and maybe cancel it?) prior to saving. It would also be great if this was part of the default templates.

Example code and issues discussed at SO @ http://stackoverflow.com/questions/1295842/how-to-intersept-the-save-method-on-activerecord