{"pull_request":{"state":"closed","deletions":26,"merged_by":{"avatar_url":"https://secure.gravatar.com/avatar/0b22453288cedbe28d53e89e0e0b793d?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"0b22453288cedbe28d53e89e0e0b793d","url":"https://api.github.com/users/bmeck","login":"bmeck","id":234659},"user":{"avatar_url":"https://secure.gravatar.com/avatar/8c403ee8b79d2640bbba7a1454137d58?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"8c403ee8b79d2640bbba7a1454137d58","url":"https://api.github.com/users/coreyjewett","login":"coreyjewett","id":12782},"updated_at":"2011-11-15T19:59:59Z","closed_at":"2011-11-15T19:59:59Z","base":{"ref":"master","user":{"avatar_url":"https://secure.gravatar.com/avatar/09088668c649256cb1f244ed326f6ec8?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","gravatar_id":"09088668c649256cb1f244ed326f6ec8","url":"https://api.github.com/users/flatiron","login":"flatiron","id":624259},"repo":{"name":"resourceful","fork":false,"master_branch":null,"pushed_at":"2011-11-15T19:59:59Z","open_issues":4,"clone_url":"https://github.com/flatiron/resourceful.git","updated_at":"2011-11-15T19:59:59Z","homepage":"http://github.com/flatiron/resourceful","svn_url":"https://svn.github.com/flatiron/resourceful","private":false,"language":"JavaScript","forks":5,"url":"https://api.github.com/repos/flatiron/resourceful","owner":{"avatar_url":"https://secure.gravatar.com/avatar/09088668c649256cb1f244ed326f6ec8?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-orgs.png","gravatar_id":"09088668c649256cb1f244ed326f6ec8","url":"https://api.github.com/users/flatiron","login":"flatiron","id":624259},"html_url":"https://github.com/flatiron/resourceful","description":"A storage agnostic resource-oriented ODM for building prototypical models with validation and sanitization.","size":224,"id":2352769,"git_url":"git://github.com/flatiron/resourceful.git","watchers":29,"created_at":"2011-09-09T01:42:16Z","ssh_url":"git@github.com:flatiron/resourceful.git"},"label":"flatiron:master","sha":"440cbae2a2a71bff97614289e0aec12dbd5dff43"},"comments":3,"diff_url":"https://github.com/flatiron/resourceful/pull/11.diff","commits":2,"head":{"ref":"master","user":{"avatar_url":"https://secure.gravatar.com/avatar/8c403ee8b79d2640bbba7a1454137d58?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"8c403ee8b79d2640bbba7a1454137d58","url":"https://api.github.com/users/coreyjewett","login":"coreyjewett","id":12782},"repo":{"name":"resourceful","fork":true,"master_branch":null,"pushed_at":"2011-11-13T12:35:13Z","open_issues":0,"clone_url":"https://github.com/coreyjewett/resourceful.git","updated_at":"2011-11-13T12:35:13Z","homepage":"http://github.com/flatiron/resourceful","svn_url":"https://svn.github.com/coreyjewett/resourceful","private":false,"language":"JavaScript","forks":0,"url":"https://api.github.com/repos/coreyjewett/resourceful","owner":{"avatar_url":"https://secure.gravatar.com/avatar/8c403ee8b79d2640bbba7a1454137d58?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"8c403ee8b79d2640bbba7a1454137d58","url":"https://api.github.com/users/coreyjewett","login":"coreyjewett","id":12782},"html_url":"https://github.com/coreyjewett/resourceful","description":"A storage agnostic resource-oriented ODM for building prototypical models with validation and sanitization.","size":120,"id":2765865,"git_url":"git://github.com/coreyjewett/resourceful.git","watchers":1,"created_at":"2011-11-13T10:26:16Z","ssh_url":"git@github.com:coreyjewett/resourceful.git"},"label":"coreyjewett:master","sha":"b6e608375bf02d83f52cba88c32840c6c840cce5"},"additions":112,"url":"https://api.github.com/repos/flatiron/resourceful/pulls/11","merged":true,"body":"\r\nMaybe these weren't implemented for a good reason? I was confronted with the choice of hook execution order. I opted for:\r\n\r\n* before.create\r\n* model instantiation\r\n* after.create\r\n* model validation\r\n* before.save (no changes)\r\n* after.save (no changes)\r\n\r\nI can't really think of a good reason for after.create under this strategy, but not implementing it seemed arbitrarily confusing.\r\n\r\nThe other two alternate execution orders that came to mind are:\r\n\r\n1. \"wrappering\" save (why would you want this? just implement an after.save hook)\r\n  * before.create\r\n  * model instantiation\r\n  * model validation\r\n  * before.save (no changes)\r\n  * after.save (no changes)\r\n  * after.create\r\n2. post-validation (this seems dangerous as you are manipulating the model after validation.)\r\n  * before.create\r\n  * model instantiation\r\n  * model validation\r\n  * after.create\r\n  * before.save (no changes)\r\n  * after.save (no changes)\r\n","merged_at":"2011-11-15T19:59:59Z","html_url":"https://github.com/flatiron/resourceful/pull/11","issue_url":"https://github.com/flatiron/resourceful/issues/11","_links":{"comments":{"href":"https://api.github.com/repos/flatiron/resourceful/issues/11/comments"},"html":{"href":"https://github.com/flatiron/resourceful/pull/11"},"review_comments":{"href":"https://api.github.com/repos/flatiron/resourceful/pulls/11/comments"},"self":{"href":"https://api.github.com/repos/flatiron/resourceful/pulls/11"}},"review_comments":0,"title":"Added before/after create hooks","number":11,"mergeable":null,"id":489664,"changed_files":2,"patch_url":"https://github.com/flatiron/resourceful/pull/11.patch","created_at":"2011-11-13T11:29:54Z"},"action":"closed","number":11}