{"action":"created","comment":{"url":"https://api.github.com/repos/alphagov/publishing-api/pulls/comments/55006275","id":55006275,"diff_hunk":"@@ -38,9 +40,24 @@ class ContentItem < ActiveRecord::Base\n   validates :description, well_formed_content_types: { must_include: \"text/html\" }\n   validates :details, well_formed_content_types: { must_include: \"text/html\" }\n \n+  before_save :convert_format\n+\n private\n \n   def renderable_content?\n     NON_RENDERABLE_FORMATS.exclude?(format)\n   end\n+\n+  def format_required?","path":"app/models/content_item.rb","position":31,"original_position":31,"commit_id":"acde5267383e1caed4d007c680ba2eea9817622c","original_commit_id":"acde5267383e1caed4d007c680ba2eea9817622c","user":{"login":"elliotcm","id":109225,"avatar_url":"https://avatars.githubusercontent.com/u/109225?v=3","gravatar_id":"","url":"https://api.github.com/users/elliotcm","html_url":"https://github.com/elliotcm","followers_url":"https://api.github.com/users/elliotcm/followers","following_url":"https://api.github.com/users/elliotcm/following{/other_user}","gists_url":"https://api.github.com/users/elliotcm/gists{/gist_id}","starred_url":"https://api.github.com/users/elliotcm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elliotcm/subscriptions","organizations_url":"https://api.github.com/users/elliotcm/orgs","repos_url":"https://api.github.com/users/elliotcm/repos","events_url":"https://api.github.com/users/elliotcm/events{/privacy}","received_events_url":"https://api.github.com/users/elliotcm/received_events","type":"User","site_admin":false},"body":"This doesn't seem to be used.","created_at":"2016-03-04T09:15:29Z","updated_at":"2016-03-04T09:15:29Z","html_url":"https://github.com/alphagov/publishing-api/pull/224#discussion_r55006275","pull_request_url":"https://api.github.com/repos/alphagov/publishing-api/pulls/224","_links":{"self":{"href":"https://api.github.com/repos/alphagov/publishing-api/pulls/comments/55006275"},"html":{"href":"https://github.com/alphagov/publishing-api/pull/224#discussion_r55006275"},"pull_request":{"href":"https://api.github.com/repos/alphagov/publishing-api/pulls/224"}}},"pull_request":{"url":"https://api.github.com/repos/alphagov/publishing-api/pulls/224","id":61529507,"html_url":"https://github.com/alphagov/publishing-api/pull/224","diff_url":"https://github.com/alphagov/publishing-api/pull/224.diff","patch_url":"https://github.com/alphagov/publishing-api/pull/224.patch","issue_url":"https://api.github.com/repos/alphagov/publishing-api/issues/224","number":224,"state":"open","locked":false,"title":"Split format field into document_type and schema_name","user":{"login":"danielroseman","id":131395,"avatar_url":"https://avatars.githubusercontent.com/u/131395?v=3","gravatar_id":"","url":"https://api.github.com/users/danielroseman","html_url":"https://github.com/danielroseman","followers_url":"https://api.github.com/users/danielroseman/followers","following_url":"https://api.github.com/users/danielroseman/following{/other_user}","gists_url":"https://api.github.com/users/danielroseman/gists{/gist_id}","starred_url":"https://api.github.com/users/danielroseman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielroseman/subscriptions","organizations_url":"https://api.github.com/users/danielroseman/orgs","repos_url":"https://api.github.com/users/danielroseman/repos","events_url":"https://api.github.com/users/danielroseman/events{/privacy}","received_events_url":"https://api.github.com/users/danielroseman/received_events","type":"User","site_admin":false},"body":"The format field is being replaced by two fields, see [RFC 41](https://gov-uk.atlassian.net/wiki/display/GOVUK/RFC+41%3A+Separate+document+type+from+format). document_type identifies the kind of the document for filtering and display purposes, and schema_name identifies which schema is used to validate the content. Often these will be the same, but some - in particular specialist documents - will have differing values.\r\n\r\nThe document_type/schema_name pair will eventually replace format everywhere. During the deprecation period we accept these as alternatives; on PUT, the one not supplied will be populated from the other. The index endpoint will filter by whichever is supplied.","created_at":"2016-03-03T09:13:39Z","updated_at":"2016-03-04T09:15:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8d800b212014744464f653c96953cc1c22c65284","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/alphagov/publishing-api/pulls/224/commits","review_comments_url":"https://api.github.com/repos/alphagov/publishing-api/pulls/224/comments","review_comment_url":"https://api.github.com/repos/alphagov/publishing-api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alphagov/publishing-api/issues/224/comments","statuses_url":"https://api.github.com/repos/alphagov/publishing-api/statuses/acde5267383e1caed4d007c680ba2eea9817622c","head":{"label":"alphagov:split_schema_field","ref":"split_schema_field","sha":"acde5267383e1caed4d007c680ba2eea9817622c","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":27546098,"name":"publishing-api","full_name":"alphagov/publishing-api","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/publishing-api","description":"Central store for all content on GOV.UK.","fork":false,"url":"https://api.github.com/repos/alphagov/publishing-api","forks_url":"https://api.github.com/repos/alphagov/publishing-api/forks","keys_url":"https://api.github.com/repos/alphagov/publishing-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/publishing-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/publishing-api/teams","hooks_url":"https://api.github.com/repos/alphagov/publishing-api/hooks","issue_events_url":"https://api.github.com/repos/alphagov/publishing-api/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/publishing-api/events","assignees_url":"https://api.github.com/repos/alphagov/publishing-api/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/publishing-api/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/publishing-api/tags","blobs_url":"https://api.github.com/repos/alphagov/publishing-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/publishing-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/publishing-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/publishing-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/publishing-api/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/publishing-api/languages","stargazers_url":"https://api.github.com/repos/alphagov/publishing-api/stargazers","contributors_url":"https://api.github.com/repos/alphagov/publishing-api/contributors","subscribers_url":"https://api.github.com/repos/alphagov/publishing-api/subscribers","subscription_url":"https://api.github.com/repos/alphagov/publishing-api/subscription","commits_url":"https://api.github.com/repos/alphagov/publishing-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/publishing-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/publishing-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/publishing-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/publishing-api/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/publishing-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/publishing-api/merges","archive_url":"https://api.github.com/repos/alphagov/publishing-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/publishing-api/downloads","issues_url":"https://api.github.com/repos/alphagov/publishing-api/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/publishing-api/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/publishing-api/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/publishing-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/publishing-api/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/publishing-api/releases{/id}","deployments_url":"https://api.github.com/repos/alphagov/publishing-api/deployments","created_at":"2014-12-04T15:15:43Z","updated_at":"2016-01-11T09:19:02Z","pushed_at":"2016-03-04T09:13:13Z","git_url":"git://github.com/alphagov/publishing-api.git","ssh_url":"git@github.com:alphagov/publishing-api.git","clone_url":"https://github.com/alphagov/publishing-api.git","svn_url":"https://github.com/alphagov/publishing-api","homepage":"","size":1509,"stargazers_count":3,"watchers_count":3,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":5,"forks":3,"open_issues":5,"watchers":3,"default_branch":"master"}},"base":{"label":"alphagov:master","ref":"master","sha":"17f6cf11ac3017585af5a40f11d6267ece433246","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":27546098,"name":"publishing-api","full_name":"alphagov/publishing-api","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/publishing-api","description":"Central store for all content on GOV.UK.","fork":false,"url":"https://api.github.com/repos/alphagov/publishing-api","forks_url":"https://api.github.com/repos/alphagov/publishing-api/forks","keys_url":"https://api.github.com/repos/alphagov/publishing-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/publishing-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/publishing-api/teams","hooks_url":"https://api.github.com/repos/alphagov/publishing-api/hooks","issue_events_url":"https://api.github.com/repos/alphagov/publishing-api/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/publishing-api/events","assignees_url":"https://api.github.com/repos/alphagov/publishing-api/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/publishing-api/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/publishing-api/tags","blobs_url":"https://api.github.com/repos/alphagov/publishing-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/publishing-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/publishing-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/publishing-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/publishing-api/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/publishing-api/languages","stargazers_url":"https://api.github.com/repos/alphagov/publishing-api/stargazers","contributors_url":"https://api.github.com/repos/alphagov/publishing-api/contributors","subscribers_url":"https://api.github.com/repos/alphagov/publishing-api/subscribers","subscription_url":"https://api.github.com/repos/alphagov/publishing-api/subscription","commits_url":"https://api.github.com/repos/alphagov/publishing-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/publishing-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/publishing-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/publishing-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/publishing-api/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/publishing-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/publishing-api/merges","archive_url":"https://api.github.com/repos/alphagov/publishing-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/publishing-api/downloads","issues_url":"https://api.github.com/repos/alphagov/publishing-api/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/publishing-api/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/publishing-api/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/publishing-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/publishing-api/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/publishing-api/releases{/id}","deployments_url":"https://api.github.com/repos/alphagov/publishing-api/deployments","created_at":"2014-12-04T15:15:43Z","updated_at":"2016-01-11T09:19:02Z","pushed_at":"2016-03-04T09:13:13Z","git_url":"git://github.com/alphagov/publishing-api.git","ssh_url":"git@github.com:alphagov/publishing-api.git","clone_url":"https://github.com/alphagov/publishing-api.git","svn_url":"https://github.com/alphagov/publishing-api","homepage":"","size":1509,"stargazers_count":3,"watchers_count":3,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":5,"forks":3,"open_issues":5,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alphagov/publishing-api/pulls/224"},"html":{"href":"https://github.com/alphagov/publishing-api/pull/224"},"issue":{"href":"https://api.github.com/repos/alphagov/publishing-api/issues/224"},"comments":{"href":"https://api.github.com/repos/alphagov/publishing-api/issues/224/comments"},"review_comments":{"href":"https://api.github.com/repos/alphagov/publishing-api/pulls/224/comments"},"review_comment":{"href":"https://api.github.com/repos/alphagov/publishing-api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alphagov/publishing-api/pulls/224/commits"},"statuses":{"href":"https://api.github.com/repos/alphagov/publishing-api/statuses/acde5267383e1caed4d007c680ba2eea9817622c"}}}}