Just FYI: Hooks are actually implemented identically to what I showed. I am
personally coming to prefer the super approach simply because it's more
obvious what's going on, and if the internal implementation of hooks
changes, I'm less likely to get bit in the ass. That said, I prefer
before_filter
@Yehuda, but i really don't want to know what's the hook is doing in
this context, i just want to know what it will trigger. That's what i
feel is convenient but either way is good, at first i tried with
overriding the method but it did not work, maybe it was the way i had
the model at first.
The thing is that DM hooks are literally a thin wrapper around what I showed
above. In that context, like I said, I am personally becoming more
comfortable just using the OO tools at my disposal, especially since
callbacks tend to become complex creatures with the addition of things like
:if, and
Rafael George wrote:
I hope there are some PHP developer's in this list, i'm trying to
override the save method in a model, my model class goes like this:
class Interest
include DataMapper::Resource
# properties
property :user_id, Integer, :key = true
property