I've always used Observers for Notifiers and such, things that aren't what the class/model is originally intended for. As in, giving the Notifier the ability to Observe the model being created. If the model/ class itself needs to do something on create, well then that would warrant an in-class filter since the class is acting in accordance to something it needs to do itself. If thats setting up objects with information from itself, or something it does, well that would be in- class.
:: Justin Reagor :: [email protected] > I tend to use observers for chain reactions (like creating models in > reaction to other actions, sending email or sms for certain actions, > etc), things that are kinda outside the model and big enough to > warrant separation. > > On Dec 16, 9:33 pm, epoch <[email protected]> wrote: >> Hi guys, I'm kind of confused at when to use what. I understand if >> you >> want to decouple your models it's a good idea to use observers, but >> what is the best practise? >> >> For example if you want to create multiple models at once there is >> several ways to do this, you can do it within the controller, >> creating >> the models one after another, or you do it through call backs within >> the model itself through associations or what not, or you do it >> through observers. >> >> Any advice would be greatly appreciated, I'm going crazy thing about >> this. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
