Instance functions for update don't work correctly in before/after hook #106

scottkf opened this Issue Aug 23, 2012 · 3 comments


None yet
3 participants

scottkf commented Aug 23, 2012

Not sure if this is intended or not

scottkf commented Aug 23, 2012

I wasn't entirely correct, before and after hooks do work on the instance/class, but you have to specify the exact method, I was mistaken in believing before(save) would trigger on update. There's still an issue where instance functions aren't working though, I'll look into that.

Edit: instance functions for update won't work in a before/after hook because update simply pushes the properties and not the object itself. A failing test:


ssevertson commented May 30, 2013

Has anyone found a work-around for this 9 month old issue? It's biting me right now, as flatiron/restful uses Resource.update for PUT requests, and I've got a number of before/after hooks which expect a fully hydrated resource, not just the update properties.


indexzero commented May 30, 2013

@ssevertson Are you running with a cache? You can pull the fully hydrated resource from the cache based on the id.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment