> For the sake of your future sanity and that of all other people who may have > to deal with your code, and furthermore, for the love of all that's holy, do > not mutate Resources in a :dirty? hook. If that's not enough of an entreaty, > please just do it for my sake. I can think of precious little reason to > mutate a resource in a :valid? hook, either. > > If you want to change a value on your resource before saving, just override > the property setter (def property_foo=(new_value); ... do something cool.... > super(correct_value); end). DM is not ActiveRecord, and you should rarely, if > ever, need to do callback-based value modification. > > But seriously, go ahead and hook :dirty? if you must, but think long and hard > about other ways to mutate your Resources before you choose to go that route. > > -- Emmanuel > > PS - This isn't directed at you, Juan, I just needed to say that loud and > clear for anyone else reading the list who might consider it a decent option.
Don't worry, I'm gonna call the method from the outside, i'm not going to hook it. -- 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.
