GitHub PullRequestEvent at 2014-05-15 19:57:34
Repository: orcid
Actor: jeremyf
Payload: {"action":"opened","number":23,"pull_request":{"url":"https://api.github.com/repos/projecthydra-labs/orcid/pulls/23","id":15954760,"html_url":"https://github.com/projecthydra-labs/orcid/pull/23","diff_url":"https://github.com/projecthydra-labs/orcid/pull/23.diff","patch_url":"https://github.com/projecthydra-labs/orcid/pull/23.patch","issue_url":"https://api.github.com/repos/projecthydra-labs/orcid/issues/23","number":23,"state":"open","title":"Fixing singular Rails resource behavior","user":{"login":"jeremyf","id":2130,"avatar_url":"https://avatars.githubusercontent.com/u/2130?","gravatar_id":"a9b7461edb06ce10e12f865220e43948","url":"https://api.github.com/users/jeremyf","html_url":"https://github.com/jeremyf","followers_url":"https://api.github.com/users/jeremyf/followers","following_url":"https://api.github.com/users/jeremyf/following{/other_user}","gists_url":"https://api.github.com/users/jeremyf/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremyf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremyf/subscriptions","organizations_url":"https://api.github.com/users/jeremyf/orgs","repos_url":"https://api.github.com/users/jeremyf/repos","events_url":"https://api.github.com/users/jeremyf/events{/privacy}","received_events_url":"https://api.github.com/users/jeremyf/received_events","type":"User","site_admin":false},"body":"Since we have a singular resource for ProfileRequest, the\r\n`Controller#respond_with` was treating the profile_request parameter\r\nas the :format option (i.e. format = 'xml').\r\n\r\nThe solution was to tease apart the automagic behavior of the\r\n`#respond_with` method into its two response options for\r\ntransformative actions - either render the page with errors or\r\nredirect due to success.\r\n\r\nI believe this is related to https://github.com/rails/rails/issues/1769,\r\nwhich is called out in http://guides.rubyonrails.org/routing.html#singular-resources\r\n\r\nBelow is a more detailed breakdown of what I am refering to:\r\n\r\nThe ProfileRequest is a singular resource.\r\n\r\n```ruby\r\nOrcid::Engine.routes.draw do\r\n  scope module: 'orcid' do\r\n    resource :profile_request, only: [:show, :new, :create]\r\n    resources :profile_connections, only: [:new, :create, :index]\r\n  end\r\nend\r\n```\r\n\r\nAs a singluar resource the following routes are available.\r\n\r\n```console\r\n$ rake app:routes\r\nRoutes for Orcid::Engine:\r\n   profile_request  POST /profile_request(.:format)     orcid/profile_requests#create\r\nnew_profile_request GET  /profile_request/new(.:format) orcid/profile_requests#new\r\n                    GET  /profile_request(.:format)     orcid/profile_requests#show\r\n```\r\n\r\nIf we had a plural resource for ProfileRequest\r\n```ruby\r\nOrcid::Engine.routes.draw do\r\n  scope module: 'orcid' do\r\n    resources :profile_request, only: [:show, :new, :create]\r\n    resources :profile_connections, only: [:new, :create, :index]\r\n  end\r\nend\r\n```\r\n\r\nThen the routes would be:\r\n```console\r\n$ rake app:routes\r\nprofile_request_index POST /profile_request(.:format)     orcid/profile_request#create\r\n  new_profile_request GET  /profile_request/new(.:format) orcid/profile_request#new\r\n      profile_request GET  /profile_request/:id(.:format) orcid/profile_request#show\r\n```","created_at":"2014-05-15T19:57:32Z","updated_at":"2014-05-15T19:57:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b2dae7206c8339a3803abee97d8aa8fb07087987","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/projecthydra-labs/orcid/pulls/23/commits","review_comments_url":"https://api.github.com/repos/projecthydra-labs/orcid/pulls/23/comments","review_comment_url":"https://api.github.com/repos/projecthydra-labs/orcid/pulls/comments/{number}","comments_url":"https://api.github.com/repos/projecthydra-labs/orcid/issues/23/comments","statuses_url":"https://api.github.com/repos/projecthydra-labs/orcid/statuses/2cdfc009514ad3fd3bfc6a07319762cd8b191a04","head":{"label":"projecthydra-labs:fixing-profile-request-format-parameter-issue","ref":"fixing-profile-request-format-parameter-issue","sha":"2cdfc009514ad3fd3bfc6a07319762cd8b191a04","user":{"login":"projecthydra-labs","id":7377013,"avatar_url":"https://avatars.githubusercontent.com/u/7377013?","gravatar_id":null,"url":"https://api.github.com/users/projecthydra-labs","html_url":"https://github.com/projecthydra-labs","followers_url":"https://api.github.com/users/projecthydra-labs/followers","following_url":"https://api.github.com/users/projecthydra-labs/following{/other_user}","gists_url":"https://api.github.com/users/projecthydra-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/projecthydra-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projecthydra-labs/subscriptions","organizations_url":"https://api.github.com/users/projecthydra-labs/orgs","repos_url":"https://api.github.com/users/projecthydra-labs/repos","events_url":"https://api.github.com/users/projecthydra-labs/events{/privacy}","received_events_url":"https://api.github.com/users/projecthydra-labs/received_events","type":"Organization","site_admin":false},"repo":{"id":17067942,"name":"orcid","full_name":"projecthydra-labs/orcid","owner":{"login":"projecthydra-labs","id":7377013,"avatar_url":"https://avatars.githubusercontent.com/u/7377013?","gravatar_id":null,"url":"https://api.github.com/users/projecthydra-labs","html_url":"https://github.com/projecthydra-labs","followers_url":"https://api.github.com/users/projecthydra-labs/followers","following_url":"https://api.github.com/users/projecthydra-labs/following{/other_user}","gists_url":"https://api.github.com/users/projecthydra-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/projecthydra-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projecthydra-labs/subscriptions","organizations_url":"https://api.github.com/users/projecthydra-labs/orgs","repos_url":"https://api.github.com/users/projecthydra-labs/repos","events_url":"https://api.github.com/users/projecthydra-labs/events{/privacy}","received_events_url":"https://api.github.com/users/projecthydra-labs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/projecthydra-labs/orcid","description":"A Rails engine for orcid.org integration.","fork":false,"url":"https://api.github.com/repos/projecthydra-labs/orcid","forks_url":"https://api.github.com/repos/projecthydra-labs/orcid/forks","keys_url":"https://api.github.com/repos/projecthydra-labs/orcid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/projecthydra-labs/orcid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/projecthydra-labs/orcid/teams","hooks_url":"https://api.github.com/repos/projecthydra-labs/orcid/hooks","issue_events_url":"https://api.github.com/repos/projecthydra-labs/orcid/issues/events{/number}","events_url":"https://api.github.com/repos/projecthydra-labs/orcid/events","assignees_url":"https://api.github.com/repos/projecthydra-labs/orcid/assignees{/user}","branches_url":"https://api.github.com/repos/projecthydra-labs/orcid/branches{/branch}","tags_url":"https://api.github.com/repos/projecthydra-labs/orcid/tags","blobs_url":"https://api.github.com/repos/projecthydra-labs/orcid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/projecthydra-labs/orcid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/projecthydra-labs/orcid/git/refs{/sha}","trees_url":"https://api.github.com/repos/projecthydra-labs/orcid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/projecthydra-labs/orcid/statuses/{sha}","languages_url":"https://api.github.com/repos/projecthydra-labs/orcid/languages","stargazers_url":"https://api.github.com/repos/projecthydra-labs/orcid/stargazers","contributors_url":"https://api.github.com/repos/projecthydra-labs/orcid/contributors","subscribers_url":"https://api.github.com/repos/projecthydra-labs/orcid/subscribers","subscription_url":"https://api.github.com/repos/projecthydra-labs/orcid/subscription","commits_url":"https://api.github.com/repos/projecthydra-labs/orcid/commits{/sha}","git_commits_url":"https://api.github.com/repos/projecthydra-labs/orcid/git/commits{/sha}","comments_url":"https://api.github.com/repos/projecthydra-labs/orcid/comments{/number}","issue_comment_url":"https://api.github.com/repos/projecthydra-labs/orcid/issues/comments/{number}","contents_url":"https://api.github.com/repos/projecthydra-labs/orcid/contents/{+path}","compare_url":"https://api.github.com/repos/projecthydra-labs/orcid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/projecthydra-labs/orcid/merges","archive_url":"https://api.github.com/repos/projecthydra-labs/orcid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/projecthydra-labs/orcid/downloads","issues_url":"https://api.github.com/repos/projecthydra-labs/orcid/issues{/number}","pulls_url":"https://api.github.com/repos/projecthydra-labs/orcid/pulls{/number}","milestones_url":"https://api.github.com/repos/projecthydra-labs/orcid/milestones{/number}","notifications_url":"https://api.github.com/repos/projecthydra-labs/orcid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/projecthydra-labs/orcid/labels{/name}","releases_url":"https://api.github.com/repos/projecthydra-labs/orcid/releases{/id}","created_at":"2014-02-21T20:00:07Z","updated_at":"2014-05-15T19:57:32Z","pushed_at":"2014-05-15T19:57:24Z","git_url":"git://github.com/projecthydra-labs/orcid.git","ssh_url":"git@github.com:projecthydra-labs/orcid.git","clone_url":"https://github.com/projecthydra-labs/orcid.git","svn_url":"https://github.com/projecthydra-labs/orcid","homepage":"https://github.com/projejcthydra-labs/orcid","size":2120,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":3,"mirror_url":null,"open_issues_count":3,"forks":3,"open_issues":3,"watchers":1,"default_branch":"master"}},"base":{"label":"projecthydra-labs:master","ref":"master","sha":"d90e5750599a3e696a0262da2c17797ed8bbae66","user":{"login":"projecthydra-labs","id":7377013,"avatar_url":"https://avatars.githubusercontent.com/u/7377013?","gravatar_id":null,"url":"https://api.github.com/users/projecthydra-labs","html_url":"https://github.com/projecthydra-labs","followers_url":"https://api.github.com/users/projecthydra-labs/followers","following_url":"https://api.github.com/users/projecthydra-labs/following{/other_user}","gists_url":"https://api.github.com/users/projecthydra-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/projecthydra-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projecthydra-labs/subscriptions","organizations_url":"https://api.github.com/users/projecthydra-labs/orgs","repos_url":"https://api.github.com/users/projecthydra-labs/repos","events_url":"https://api.github.com/users/projecthydra-labs/events{/privacy}","received_events_url":"https://api.github.com/users/projecthydra-labs/received_events","type":"Organization","site_admin":false},"repo":{"id":17067942,"name":"orcid","full_name":"projecthydra-labs/orcid","owner":{"login":"projecthydra-labs","id":7377013,"avatar_url":"https://avatars.githubusercontent.com/u/7377013?","gravatar_id":null,"url":"https://api.github.com/users/projecthydra-labs","html_url":"https://github.com/projecthydra-labs","followers_url":"https://api.github.com/users/projecthydra-labs/followers","following_url":"https://api.github.com/users/projecthydra-labs/following{/other_user}","gists_url":"https://api.github.com/users/projecthydra-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/projecthydra-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projecthydra-labs/subscriptions","organizations_url":"https://api.github.com/users/projecthydra-labs/orgs","repos_url":"https://api.github.com/users/projecthydra-labs/repos","events_url":"https://api.github.com/users/projecthydra-labs/events{/privacy}","received_events_url":"https://api.github.com/users/projecthydra-labs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/projecthydra-labs/orcid","description":"A Rails engine for orcid.org integration.","fork":false,"url":"https://api.github.com/repos/projecthydra-labs/orcid","forks_url":"https://api.github.com/repos/projecthydra-labs/orcid/forks","keys_url":"https://api.github.com/repos/projecthydra-labs/orcid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/projecthydra-labs/orcid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/projecthydra-labs/orcid/teams","hooks_url":"https://api.github.com/repos/projecthydra-labs/orcid/hooks","issue_events_url":"https://api.github.com/repos/projecthydra-labs/orcid/issues/events{/number}","events_url":"https://api.github.com/repos/projecthydra-labs/orcid/events","assignees_url":"https://api.github.com/repos/projecthydra-labs/orcid/assignees{/user}","branches_url":"https://api.github.com/repos/projecthydra-labs/orcid/branches{/branch}","tags_url":"https://api.github.com/repos/projecthydra-labs/orcid/tags","blobs_url":"https://api.github.com/repos/projecthydra-labs/orcid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/projecthydra-labs/orcid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/projecthydra-labs/orcid/git/refs{/sha}","trees_url":"https://api.github.com/repos/projecthydra-labs/orcid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/projecthydra-labs/orcid/statuses/{sha}","languages_url":"https://api.github.com/repos/projecthydra-labs/orcid/languages","stargazers_url":"https://api.github.com/repos/projecthydra-labs/orcid/stargazers","contributors_url":"https://api.github.com/repos/projecthydra-labs/orcid/contributors","subscribers_url":"https://api.github.com/repos/projecthydra-labs/orcid/subscribers","subscription_url":"https://api.github.com/repos/projecthydra-labs/orcid/subscription","commits_url":"https://api.github.com/repos/projecthydra-labs/orcid/commits{/sha}","git_commits_url":"https://api.github.com/repos/projecthydra-labs/orcid/git/commits{/sha}","comments_url":"https://api.github.com/repos/projecthydra-labs/orcid/comments{/number}","issue_comment_url":"https://api.github.com/repos/projecthydra-labs/orcid/issues/comments/{number}","contents_url":"https://api.github.com/repos/projecthydra-labs/orcid/contents/{+path}","compare_url":"https://api.github.com/repos/projecthydra-labs/orcid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/projecthydra-labs/orcid/merges","archive_url":"https://api.github.com/repos/projecthydra-labs/orcid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/projecthydra-labs/orcid/downloads","issues_url":"https://api.github.com/repos/projecthydra-labs/orcid/issues{/number}","pulls_url":"https://api.github.com/repos/projecthydra-labs/orcid/pulls{/number}","milestones_url":"https://api.github.com/repos/projecthydra-labs/orcid/milestones{/number}","notifications_url":"https://api.github.com/repos/projecthydra-labs/orcid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/projecthydra-labs/orcid/labels{/name}","releases_url":"https://api.github.com/repos/projecthydra-labs/orcid/releases{/id}","created_at":"2014-02-21T20:00:07Z","updated_at":"2014-05-15T19:57:32Z","pushed_at":"2014-05-15T19:57:24Z","git_url":"git://github.com/projecthydra-labs/orcid.git","ssh_url":"git@github.com:projecthydra-labs/orcid.git","clone_url":"https://github.com/projecthydra-labs/orcid.git","svn_url":"https://github.com/projecthydra-labs/orcid","homepage":"https://github.com/projejcthydra-labs/orcid","size":2120,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":3,"mirror_url":null,"open_issues_count":3,"forks":3,"open_issues":3,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/projecthydra-labs/orcid/pulls/23"},"html":{"href":"https://github.com/projecthydra-labs/orcid/pull/23"},"issue":{"href":"https://api.github.com/repos/projecthydra-labs/orcid/issues/23"},"comments":{"href":"https://api.github.com/repos/projecthydra-labs/orcid/issues/23/comments"},"review_comments":{"href":"https://api.github.com/repos/projecthydra-labs/orcid/pulls/23/comments"},"review_comment":{"href":"https://api.github.com/repos/projecthydra-labs/orcid/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/projecthydra-labs/orcid/pulls/23/commits"},"statuses":{"href":"https://api.github.com/repos/projecthydra-labs/orcid/statuses/2cdfc009514ad3fd3bfc6a07319762cd8b191a04"}},"merged":false,"mergeable":true,"mergeable_state":"unstable","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":40,"deletions":3,"changed_files":3}}