[elephant-devel] Persistance and Model Validations

Daniel Salama lists at infoway.net
Fri Aug 11 21:17:47 UTC 2006


Hi,

This may be more of a suggestion since I think I already know the  
answer.

I come from the Ruby On Rails world and, as some of you may know,  
their Active Record module provides hooks that allow the automatic  
and customized evaluation of validation rules at different stages of  
the committing process.

At first, I was going to as how can I hook validation rules into the  
persistent machinery. I guess I could (should) always wrap my commits  
in transactions and then I could perform the validation process  
within the transaction and, therefore, I could commit or abort  
depending on the validation results.

However, as my Lisp knowledge is still limited, I'd like to suggest  
for some future version of Elephant, the inclusion of some type of  
macro that works somehow like a with-transaction type operation. This  
macro could support generic methods that could be "customized" per  
class just like CLOS generic methods to support model validation.  
Just for reference, Rails validation hooks support, among others:

- before validation
- after validation
- before create
- after create
- before save
- after save
- before destroy
- after destroy

Maybe some of this functionality could be implemented in the near  
future. Maybe it's not that big of a deal, but, since my Lisp  
knowledge is limited, I am just throwing this suggestion.

Then again, maybe there is a better way to do it and I just have too  
much of a Rails mentality for the time being :)

Thanks,
Daniel



More information about the elephant-devel mailing list