{"action":"closed","number":5,"pull_request":{"url":"https://api.github.com/repos/bbean86/super_serial/pulls/5","id":27949655,"html_url":"https://github.com/bbean86/super_serial/pull/5","diff_url":"https://github.com/bbean86/super_serial/pull/5.diff","patch_url":"https://github.com/bbean86/super_serial/pull/5.patch","issue_url":"https://api.github.com/repos/bbean86/super_serial/issues/5","number":5,"state":"closed","locked":false,"title":"Change the way the super serialized column responds to #to_json.","user":{"login":"bbean86","id":2555196,"avatar_url":"https://avatars.githubusercontent.com/u/2555196?v=3","gravatar_id":"","url":"https://api.github.com/users/bbean86","html_url":"https://github.com/bbean86","followers_url":"https://api.github.com/users/bbean86/followers","following_url":"https://api.github.com/users/bbean86/following{/other_user}","gists_url":"https://api.github.com/users/bbean86/gists{/gist_id}","starred_url":"https://api.github.com/users/bbean86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbean86/subscriptions","organizations_url":"https://api.github.com/users/bbean86/orgs","repos_url":"https://api.github.com/users/bbean86/repos","events_url":"https://api.github.com/users/bbean86/events{/privacy}","received_events_url":"https://api.github.com/users/bbean86/received_events","type":"User","site_admin":false},"body":"## Summary \r\nFrom the pivotal story: \r\n\r\n`OpenStruct#to_json` responds with an undesirable structure (the key-value pairs representing the object's 'data' are in a key named table instead of returned as on object themselves). We should subclass `OpenStruct` and override its `#to_json` method so we can respond with the pertinent data itself. \r\n\r\nEx: \r\n```\r\no_struct = OpenStruct.new(name: 'my_struct')\r\n => #<OpenStruct name=\"my_struct\">\r\n\r\no_struct.to_json\r\n => \"{\\\"table\\\":{\\\"name\\\":\\\"my_struct\\\"}}\" \r\n```\r\nWe want this behavior:\r\n*DataStruct is a new subclass of OpenStruct*\r\n```\r\ndata_struct = DataStruct.new(name: 'my_struct')\r\n => #<DataStruct name=\"my_struct\">\r\n\r\ndata_struct.to_json\r\n => \"{\\\"name\\\":\\\"my_struct\\\"}\"\r\n``` \r\n\r\nThe reason this response is important is for JSON serialization considerations. If you use `ActiveModel::Serializer` (or any other method of serialization that relies on `#to_json`) to serialize the data from a `super_serial` enabled column, without this update your structure would have the undesirable `table` key. With the update, `#to_json` will provide the object for consumption by `ActiveModel::Serializer` nicely.","created_at":"2015-01-23T19:44:10Z","updated_at":"2015-01-23T20:15:42Z","closed_at":"2015-01-23T20:15:42Z","merged_at":"2015-01-23T20:15:42Z","merge_commit_sha":"008845d99ac189feb85021bb620765c00eeb0d99","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bbean86/super_serial/pulls/5/commits","review_comments_url":"https://api.github.com/repos/bbean86/super_serial/pulls/5/comments","review_comment_url":"https://api.github.com/repos/bbean86/super_serial/pulls/comments/{number}","comments_url":"https://api.github.com/repos/bbean86/super_serial/issues/5/comments","statuses_url":"https://api.github.com/repos/bbean86/super_serial/statuses/28675b35816f094ceca0962c4f4a1bd7b44c5073","head":{"label":"bbean86:ben/update-to-json","ref":"ben/update-to-json","sha":"28675b35816f094ceca0962c4f4a1bd7b44c5073","user":{"login":"bbean86","id":2555196,"avatar_url":"https://avatars.githubusercontent.com/u/2555196?v=3","gravatar_id":"","url":"https://api.github.com/users/bbean86","html_url":"https://github.com/bbean86","followers_url":"https://api.github.com/users/bbean86/followers","following_url":"https://api.github.com/users/bbean86/following{/other_user}","gists_url":"https://api.github.com/users/bbean86/gists{/gist_id}","starred_url":"https://api.github.com/users/bbean86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbean86/subscriptions","organizations_url":"https://api.github.com/users/bbean86/orgs","repos_url":"https://api.github.com/users/bbean86/repos","events_url":"https://api.github.com/users/bbean86/events{/privacy}","received_events_url":"https://api.github.com/users/bbean86/received_events","type":"User","site_admin":false},"repo":{"id":19547966,"name":"super_serial","full_name":"bbean86/super_serial","owner":{"login":"bbean86","id":2555196,"avatar_url":"https://avatars.githubusercontent.com/u/2555196?v=3","gravatar_id":"","url":"https://api.github.com/users/bbean86","html_url":"https://github.com/bbean86","followers_url":"https://api.github.com/users/bbean86/followers","following_url":"https://api.github.com/users/bbean86/following{/other_user}","gists_url":"https://api.github.com/users/bbean86/gists{/gist_id}","starred_url":"https://api.github.com/users/bbean86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbean86/subscriptions","organizations_url":"https://api.github.com/users/bbean86/orgs","repos_url":"https://api.github.com/users/bbean86/repos","events_url":"https://api.github.com/users/bbean86/events{/privacy}","received_events_url":"https://api.github.com/users/bbean86/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bbean86/super_serial","description":"Rails' serialize, on steroids","fork":false,"url":"https://api.github.com/repos/bbean86/super_serial","forks_url":"https://api.github.com/repos/bbean86/super_serial/forks","keys_url":"https://api.github.com/repos/bbean86/super_serial/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bbean86/super_serial/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bbean86/super_serial/teams","hooks_url":"https://api.github.com/repos/bbean86/super_serial/hooks","issue_events_url":"https://api.github.com/repos/bbean86/super_serial/issues/events{/number}","events_url":"https://api.github.com/repos/bbean86/super_serial/events","assignees_url":"https://api.github.com/repos/bbean86/super_serial/assignees{/user}","branches_url":"https://api.github.com/repos/bbean86/super_serial/branches{/branch}","tags_url":"https://api.github.com/repos/bbean86/super_serial/tags","blobs_url":"https://api.github.com/repos/bbean86/super_serial/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bbean86/super_serial/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bbean86/super_serial/git/refs{/sha}","trees_url":"https://api.github.com/repos/bbean86/super_serial/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bbean86/super_serial/statuses/{sha}","languages_url":"https://api.github.com/repos/bbean86/super_serial/languages","stargazers_url":"https://api.github.com/repos/bbean86/super_serial/stargazers","contributors_url":"https://api.github.com/repos/bbean86/super_serial/contributors","subscribers_url":"https://api.github.com/repos/bbean86/super_serial/subscribers","subscription_url":"https://api.github.com/repos/bbean86/super_serial/subscription","commits_url":"https://api.github.com/repos/bbean86/super_serial/commits{/sha}","git_commits_url":"https://api.github.com/repos/bbean86/super_serial/git/commits{/sha}","comments_url":"https://api.github.com/repos/bbean86/super_serial/comments{/number}","issue_comment_url":"https://api.github.com/repos/bbean86/super_serial/issues/comments/{number}","contents_url":"https://api.github.com/repos/bbean86/super_serial/contents/{+path}","compare_url":"https://api.github.com/repos/bbean86/super_serial/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bbean86/super_serial/merges","archive_url":"https://api.github.com/repos/bbean86/super_serial/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bbean86/super_serial/downloads","issues_url":"https://api.github.com/repos/bbean86/super_serial/issues{/number}","pulls_url":"https://api.github.com/repos/bbean86/super_serial/pulls{/number}","milestones_url":"https://api.github.com/repos/bbean86/super_serial/milestones{/number}","notifications_url":"https://api.github.com/repos/bbean86/super_serial/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bbean86/super_serial/labels{/name}","releases_url":"https://api.github.com/repos/bbean86/super_serial/releases{/id}","created_at":"2014-05-07T19:46:00Z","updated_at":"2014-10-06T22:03:38Z","pushed_at":"2015-01-23T20:15:42Z","git_url":"git://github.com/bbean86/super_serial.git","ssh_url":"git@github.com:bbean86/super_serial.git","clone_url":"https://github.com/bbean86/super_serial.git","svn_url":"https://github.com/bbean86/super_serial","homepage":"","size":564,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"bbean86:master","ref":"master","sha":"251ac04620a02438aa5edb5065f14330692b7d14","user":{"login":"bbean86","id":2555196,"avatar_url":"https://avatars.githubusercontent.com/u/2555196?v=3","gravatar_id":"","url":"https://api.github.com/users/bbean86","html_url":"https://github.com/bbean86","followers_url":"https://api.github.com/users/bbean86/followers","following_url":"https://api.github.com/users/bbean86/following{/other_user}","gists_url":"https://api.github.com/users/bbean86/gists{/gist_id}","starred_url":"https://api.github.com/users/bbean86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbean86/subscriptions","organizations_url":"https://api.github.com/users/bbean86/orgs","repos_url":"https://api.github.com/users/bbean86/repos","events_url":"https://api.github.com/users/bbean86/events{/privacy}","received_events_url":"https://api.github.com/users/bbean86/received_events","type":"User","site_admin":false},"repo":{"id":19547966,"name":"super_serial","full_name":"bbean86/super_serial","owner":{"login":"bbean86","id":2555196,"avatar_url":"https://avatars.githubusercontent.com/u/2555196?v=3","gravatar_id":"","url":"https://api.github.com/users/bbean86","html_url":"https://github.com/bbean86","followers_url":"https://api.github.com/users/bbean86/followers","following_url":"https://api.github.com/users/bbean86/following{/other_user}","gists_url":"https://api.github.com/users/bbean86/gists{/gist_id}","starred_url":"https://api.github.com/users/bbean86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbean86/subscriptions","organizations_url":"https://api.github.com/users/bbean86/orgs","repos_url":"https://api.github.com/users/bbean86/repos","events_url":"https://api.github.com/users/bbean86/events{/privacy}","received_events_url":"https://api.github.com/users/bbean86/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bbean86/super_serial","description":"Rails' serialize, on steroids","fork":false,"url":"https://api.github.com/repos/bbean86/super_serial","forks_url":"https://api.github.com/repos/bbean86/super_serial/forks","keys_url":"https://api.github.com/repos/bbean86/super_serial/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bbean86/super_serial/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bbean86/super_serial/teams","hooks_url":"https://api.github.com/repos/bbean86/super_serial/hooks","issue_events_url":"https://api.github.com/repos/bbean86/super_serial/issues/events{/number}","events_url":"https://api.github.com/repos/bbean86/super_serial/events","assignees_url":"https://api.github.com/repos/bbean86/super_serial/assignees{/user}","branches_url":"https://api.github.com/repos/bbean86/super_serial/branches{/branch}","tags_url":"https://api.github.com/repos/bbean86/super_serial/tags","blobs_url":"https://api.github.com/repos/bbean86/super_serial/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bbean86/super_serial/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bbean86/super_serial/git/refs{/sha}","trees_url":"https://api.github.com/repos/bbean86/super_serial/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bbean86/super_serial/statuses/{sha}","languages_url":"https://api.github.com/repos/bbean86/super_serial/languages","stargazers_url":"https://api.github.com/repos/bbean86/super_serial/stargazers","contributors_url":"https://api.github.com/repos/bbean86/super_serial/contributors","subscribers_url":"https://api.github.com/repos/bbean86/super_serial/subscribers","subscription_url":"https://api.github.com/repos/bbean86/super_serial/subscription","commits_url":"https://api.github.com/repos/bbean86/super_serial/commits{/sha}","git_commits_url":"https://api.github.com/repos/bbean86/super_serial/git/commits{/sha}","comments_url":"https://api.github.com/repos/bbean86/super_serial/comments{/number}","issue_comment_url":"https://api.github.com/repos/bbean86/super_serial/issues/comments/{number}","contents_url":"https://api.github.com/repos/bbean86/super_serial/contents/{+path}","compare_url":"https://api.github.com/repos/bbean86/super_serial/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bbean86/super_serial/merges","archive_url":"https://api.github.com/repos/bbean86/super_serial/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bbean86/super_serial/downloads","issues_url":"https://api.github.com/repos/bbean86/super_serial/issues{/number}","pulls_url":"https://api.github.com/repos/bbean86/super_serial/pulls{/number}","milestones_url":"https://api.github.com/repos/bbean86/super_serial/milestones{/number}","notifications_url":"https://api.github.com/repos/bbean86/super_serial/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bbean86/super_serial/labels{/name}","releases_url":"https://api.github.com/repos/bbean86/super_serial/releases{/id}","created_at":"2014-05-07T19:46:00Z","updated_at":"2014-10-06T22:03:38Z","pushed_at":"2015-01-23T20:15:42Z","git_url":"git://github.com/bbean86/super_serial.git","ssh_url":"git@github.com:bbean86/super_serial.git","clone_url":"https://github.com/bbean86/super_serial.git","svn_url":"https://github.com/bbean86/super_serial","homepage":"","size":564,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bbean86/super_serial/pulls/5"},"html":{"href":"https://github.com/bbean86/super_serial/pull/5"},"issue":{"href":"https://api.github.com/repos/bbean86/super_serial/issues/5"},"comments":{"href":"https://api.github.com/repos/bbean86/super_serial/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/bbean86/super_serial/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/bbean86/super_serial/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/bbean86/super_serial/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/bbean86/super_serial/statuses/28675b35816f094ceca0962c4f4a1bd7b44c5073"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"bbean86","id":2555196,"avatar_url":"https://avatars.githubusercontent.com/u/2555196?v=3","gravatar_id":"","url":"https://api.github.com/users/bbean86","html_url":"https://github.com/bbean86","followers_url":"https://api.github.com/users/bbean86/followers","following_url":"https://api.github.com/users/bbean86/following{/other_user}","gists_url":"https://api.github.com/users/bbean86/gists{/gist_id}","starred_url":"https://api.github.com/users/bbean86/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbean86/subscriptions","organizations_url":"https://api.github.com/users/bbean86/orgs","repos_url":"https://api.github.com/users/bbean86/repos","events_url":"https://api.github.com/users/bbean86/events{/privacy}","received_events_url":"https://api.github.com/users/bbean86/received_events","type":"User","site_admin":false},"comments":3,"review_comments":0,"commits":1,"additions":20,"deletions":2,"changed_files":5}}