Tiberiu, > I have the situation where I define a callback after save. In the > callback, I need to update some of the object's attributes. Calling > update_attributes() or save() from the callback will result in an > infinite loop (since the callback will be called again). > How can I do to solve this problem
If you are running dm-core/next (edge) you can use Resource#update! within your callback. It will allow you to modify attributes in the Resource bypassing callbacks. The #create!, #update!, #destroy! and #save! methods operate directly on the Collection or Resource, bypassing callbacks and validation. -- Dan Kubb (dkubb) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/datamapper?hl=en -~----------~----~----~----~------~----~------~--~---
