flatiron/resourceful — pull request #11 by coreyjewett (2011-11-13 11:29:54+00:00)
Title: Added before/after create hooks

Maybe these weren't implemented for a good reason? I was confronted with the choice of hook execution order. I opted for:

* before.create
* model instantiation
* after.create
* model validation
* before.save (no changes)
* after.save (no changes)

I can't really think of a good reason for after.create under this strategy, but not implementing it seemed arbitrarily confusing.

The other two alternate execution orders that came to mind are:

1. "wrappering" save (why would you want this? just implement an after.save hook)
* before.create
* model instantiation
* model validation
* before.save (no changes)
* after.save (no changes)
* after.create
2. post-validation (this seems dangerous as you are manipulating the model after validation.)
* before.create
* model instantiation
* model validation
* after.create
* before.save (no changes)
* after.save (no changes)