{"action":"created","issue":{"url":"https://api.github.com/repos/alphagov/service-manual-publisher/issues/17","labels_url":"https://api.github.com/repos/alphagov/service-manual-publisher/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/alphagov/service-manual-publisher/issues/17/comments","events_url":"https://api.github.com/repos/alphagov/service-manual-publisher/issues/17/events","html_url":"https://github.com/alphagov/service-manual-publisher/pull/17","id":112344787,"number":17,"title":"Flow basics","user":{"login":"tadast","id":218239,"avatar_url":"https://avatars.githubusercontent.com/u/218239?v=3","gravatar_id":"","url":"https://api.github.com/users/tadast","html_url":"https://github.com/tadast","followers_url":"https://api.github.com/users/tadast/followers","following_url":"https://api.github.com/users/tadast/following{/other_user}","gists_url":"https://api.github.com/users/tadast/gists{/gist_id}","starred_url":"https://api.github.com/users/tadast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tadast/subscriptions","organizations_url":"https://api.github.com/users/tadast/orgs","repos_url":"https://api.github.com/users/tadast/repos","events_url":"https://api.github.com/users/tadast/events{/privacy}","received_events_url":"https://api.github.com/users/tadast/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-10-20T11:13:27Z","updated_at":"2015-10-20T13:22:51Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/alphagov/service-manual-publisher/pulls/17","html_url":"https://github.com/alphagov/service-manual-publisher/pull/17","diff_url":"https://github.com/alphagov/service-manual-publisher/pull/17.diff","patch_url":"https://github.com/alphagov/service-manual-publisher/pull/17.patch"},"body":"Add the very basic part of the content editing flow: if the latest editions of a guide is published, save a new edition instead of updating the published one. This essentially means that currently there can be only one work in progress edition draft, once it's published it should never change.\r\n\r\nI've also added a list of guides with an action that indicates whether a new edition will be created or an existing one is going to be edited.\r\n\r\n![screenshot 2015-10-20 12 07 54](https://cloud.githubusercontent.com/assets/218239/10605449/6331556c-7723-11e5-8275-519d99eb0fd4.png)\r\n\r\nI'm not entirely happy with the implementation, I had to create Guide#update_attributes_from_params to ensure we do not update the existing latest_edition when it's in state = 'published'. Simply assigning a new instance of edition to guide.latest_edition doesn't work, because it's a has_one relationship and Rails deletes the old latest_edition record when a new instance is assigned.\r\n"},"comment":{"url":"https://api.github.com/repos/alphagov/service-manual-publisher/issues/comments/149566753","html_url":"https://github.com/alphagov/service-manual-publisher/pull/17#issuecomment-149566753","issue_url":"https://api.github.com/repos/alphagov/service-manual-publisher/issues/17","id":149566753,"user":{"login":"AndrewVos","id":363618,"avatar_url":"https://avatars.githubusercontent.com/u/363618?v=3","gravatar_id":"","url":"https://api.github.com/users/AndrewVos","html_url":"https://github.com/AndrewVos","followers_url":"https://api.github.com/users/AndrewVos/followers","following_url":"https://api.github.com/users/AndrewVos/following{/other_user}","gists_url":"https://api.github.com/users/AndrewVos/gists{/gist_id}","starred_url":"https://api.github.com/users/AndrewVos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndrewVos/subscriptions","organizations_url":"https://api.github.com/users/AndrewVos/orgs","repos_url":"https://api.github.com/users/AndrewVos/repos","events_url":"https://api.github.com/users/AndrewVos/events{/privacy}","received_events_url":"https://api.github.com/users/AndrewVos/received_events","type":"User","site_admin":false},"created_at":"2015-10-20T13:22:51Z","updated_at":"2015-10-20T13:22:51Z","body":"lgtm :+1: "}}