{"action":"closed","issue":{"url":"https://api.github.com/repos/emberjs/ember.js/issues/10849","labels_url":"https://api.github.com/repos/emberjs/ember.js/issues/10849/labels{/name}","comments_url":"https://api.github.com/repos/emberjs/ember.js/issues/10849/comments","events_url":"https://api.github.com/repos/emberjs/ember.js/issues/10849/events","html_url":"https://github.com/emberjs/ember.js/issues/10849","id":67188397,"number":10849,"title":"[DOCS] need info on the accepted ember pattern for \"new\" and \"edit\" routes","user":{"login":"foxnewsnetwork","id":1010423,"avatar_url":"https://avatars.githubusercontent.com/u/1010423?v=3","gravatar_id":"","url":"https://api.github.com/users/foxnewsnetwork","html_url":"https://github.com/foxnewsnetwork","followers_url":"https://api.github.com/users/foxnewsnetwork/followers","following_url":"https://api.github.com/users/foxnewsnetwork/following{/other_user}","gists_url":"https://api.github.com/users/foxnewsnetwork/gists{/gist_id}","starred_url":"https://api.github.com/users/foxnewsnetwork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foxnewsnetwork/subscriptions","organizations_url":"https://api.github.com/users/foxnewsnetwork/orgs","repos_url":"https://api.github.com/users/foxnewsnetwork/repos","events_url":"https://api.github.com/users/foxnewsnetwork/events{/privacy}","received_events_url":"https://api.github.com/users/foxnewsnetwork/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-08T18:20:06Z","updated_at":"2015-08-16T14:47:34Z","closed_at":"2015-08-16T14:47:34Z","body":"Suppose you have a DS.Model, Comment. There is a very common resourceful pattern of having a CommentsRoute, CommentRoute, CommetsNewRoute, and a CommentEditRoute . In the case of edit and new, the route needs something like:\r\n\r\n```coffee\r\n# 1.9 and above\r\nCommentsNewRoute = Ember.Route.extend\r\n  model: ->\r\n    @store.createRecord \"comment\"\r\n\r\n  tearDown: Ember.on \"deactivate\", ->\r\n    model = @get \"controller.model\"\r\n    model.deleteRecord() if model.get('isDirty')\r\n```\r\nor \r\n```coffee\r\n# below 1.9\r\nCommentsNewRoute = Ember.Route.extend\r\n  model: ->\r\n    @store.createRecord \"comment\"\r\n\r\n  actions:\r\n    willTransition: ->\r\n      model = @get \"controller.model\"\r\n      model.deleteRecord() if model.get('isDirty')\r\n```\r\nor\r\n``` coffee\r\nCommentsNewRoute = Ember.Route.extend\r\n  model: ->\r\n    {}\r\n```\r\nThis need for a clean up on new (and a rollback on edit) is such a common requirement, that I feel the documentation on Ember's website should really just puts its foot down and recommend the Ember canon way of doing this ( considering deactivate was rolled in on 1.9, I'd assume the first one is what would be recommended ). \r\n\r\nAnyway, please let me know what you guys think, and if I should do a PR on the documentation or not. "}}