{"action":"created","comment":{"url":"https://api.github.com/repos/phoenixframework/phoenix/pulls/comments/111635872","pull_request_review_id":32897585,"id":111635872,"diff_hunk":"@@ -99,7 +99,7 @@ defmodule Mix.Tasks.Phx.Gen.Context do\n     {opts, parsed, _} = parse_opts(args)\n     [context_name, schema_name, plural | schema_args] = validate_args!(parsed)\n \n-    table = Keyword.get(opts, :table, Phoenix.Naming.underscore(context_name) <> \"_#{plural}\")\n+    table = Keyword.get(opts, :table, (Phoenix.Naming.underscore(context_name) |> String.replace(\"/\",\"_\")) <> \"_#{plural}\")","path":"lib/mix/tasks/phx.gen.context.ex","position":5,"original_position":5,"commit_id":"d847b63e32c56eace4d7bf6e2b830a567c9b8877","original_commit_id":"d847b63e32c56eace4d7bf6e2b830a567c9b8877","user":{"login":"kelvinst","id":2791965,"avatar_url":"https://avatars3.githubusercontent.com/u/2791965?v=3","gravatar_id":"","url":"https://api.github.com/users/kelvinst","html_url":"https://github.com/kelvinst","followers_url":"https://api.github.com/users/kelvinst/followers","following_url":"https://api.github.com/users/kelvinst/following{/other_user}","gists_url":"https://api.github.com/users/kelvinst/gists{/gist_id}","starred_url":"https://api.github.com/users/kelvinst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kelvinst/subscriptions","organizations_url":"https://api.github.com/users/kelvinst/orgs","repos_url":"https://api.github.com/users/kelvinst/repos","events_url":"https://api.github.com/users/kelvinst/events{/privacy}","received_events_url":"https://api.github.com/users/kelvinst/received_events","type":"User","site_admin":false},"body":"I would just change `Phoenix.Naming.underscore(context_name)` to `context_name |> Phoenix.Naming.underscore`. Prefer \"pure\" values over function calls when starting the pipe chain, [here is the link](https://github.com/rrrene/elixir-style-guide#pipe-chains) the the styleguide definition.","created_at":"2017-04-14T21:04:47Z","updated_at":"2017-04-14T21:05:28Z","html_url":"https://github.com/phoenixframework/phoenix/pull/2250#discussion_r111635872","pull_request_url":"https://api.github.com/repos/phoenixframework/phoenix/pulls/2250","_links":{"self":{"href":"https://api.github.com/repos/phoenixframework/phoenix/pulls/comments/111635872"},"html":{"href":"https://github.com/phoenixframework/phoenix/pull/2250#discussion_r111635872"},"pull_request":{"href":"https://api.github.com/repos/phoenixframework/phoenix/pulls/2250"}}},"pull_request":{"url":"https://api.github.com/repos/phoenixframework/phoenix/pulls/2250","id":115890980,"html_url":"https://github.com/phoenixframework/phoenix/pull/2250","diff_url":"https://github.com/phoenixframework/phoenix/pull/2250.diff","patch_url":"https://github.com/phoenixframework/phoenix/pull/2250.patch","issue_url":"https://api.github.com/repos/phoenixframework/phoenix/issues/2250","number":2250,"state":"open","locked":false,"title":"Fix nested context module name (#2240)","user":{"login":"lalo2302","id":4089078,"avatar_url":"https://avatars0.githubusercontent.com/u/4089078?v=3","gravatar_id":"","url":"https://api.github.com/users/lalo2302","html_url":"https://github.com/lalo2302","followers_url":"https://api.github.com/users/lalo2302/followers","following_url":"https://api.github.com/users/lalo2302/following{/other_user}","gists_url":"https://api.github.com/users/lalo2302/gists{/gist_id}","starred_url":"https://api.github.com/users/lalo2302/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lalo2302/subscriptions","organizations_url":"https://api.github.com/users/lalo2302/orgs","repos_url":"https://api.github.com/users/lalo2302/repos","events_url":"https://api.github.com/users/lalo2302/events{/privacy}","received_events_url":"https://api.github.com/users/lalo2302/received_events","type":"User","site_admin":false},"body":"#2240 \r\n\r\n1. To make the table name I made a new method (`Context.underscore/1`) that underscores the context name without `.`, to prevent the `\\` character as a result of `Phoenix.Naming.underscore/1`.\r\n\r\n```\r\ndef underscore(context_name) do\r\n  context_name\r\n  |> String.replace(\".\",\"\")\r\n  |> Phoenix.Naming.underscore\r\nend\r\n```\r\n\r\n2. The basename of the context is going to be the last word of a list split by `.` in case the module name is a nested context.\r\n3. The directories will use `Phoenix.Naming.underscore/1` like before to take advantage of the `\\` character.","created_at":"2017-04-14T06:40:41Z","updated_at":"2017-04-14T21:05:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1e09b53443573c33c21726aee612986a523ada21","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/phoenixframework/phoenix/pulls/2250/commits","review_comments_url":"https://api.github.com/repos/phoenixframework/phoenix/pulls/2250/comments","review_comment_url":"https://api.github.com/repos/phoenixframework/phoenix/pulls/comments{/number}","comments_url":"https://api.github.com/repos/phoenixframework/phoenix/issues/2250/comments","statuses_url":"https://api.github.com/repos/phoenixframework/phoenix/statuses/d847b63e32c56eace4d7bf6e2b830a567c9b8877","head":{"label":"lalo2302:bugfix-2240","ref":"bugfix-2240","sha":"d847b63e32c56eace4d7bf6e2b830a567c9b8877","user":{"login":"lalo2302","id":4089078,"avatar_url":"https://avatars0.githubusercontent.com/u/4089078?v=3","gravatar_id":"","url":"https://api.github.com/users/lalo2302","html_url":"https://github.com/lalo2302","followers_url":"https://api.github.com/users/lalo2302/followers","following_url":"https://api.github.com/users/lalo2302/following{/other_user}","gists_url":"https://api.github.com/users/lalo2302/gists{/gist_id}","starred_url":"https://api.github.com/users/lalo2302/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lalo2302/subscriptions","organizations_url":"https://api.github.com/users/lalo2302/orgs","repos_url":"https://api.github.com/users/lalo2302/repos","events_url":"https://api.github.com/users/lalo2302/events{/privacy}","received_events_url":"https://api.github.com/users/lalo2302/received_events","type":"User","site_admin":false},"repo":{"id":88193299,"name":"phoenix","full_name":"lalo2302/phoenix","owner":{"login":"lalo2302","id":4089078,"avatar_url":"https://avatars0.githubusercontent.com/u/4089078?v=3","gravatar_id":"","url":"https://api.github.com/users/lalo2302","html_url":"https://github.com/lalo2302","followers_url":"https://api.github.com/users/lalo2302/followers","following_url":"https://api.github.com/users/lalo2302/following{/other_user}","gists_url":"https://api.github.com/users/lalo2302/gists{/gist_id}","starred_url":"https://api.github.com/users/lalo2302/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lalo2302/subscriptions","organizations_url":"https://api.github.com/users/lalo2302/orgs","repos_url":"https://api.github.com/users/lalo2302/repos","events_url":"https://api.github.com/users/lalo2302/events{/privacy}","received_events_url":"https://api.github.com/users/lalo2302/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lalo2302/phoenix","description":"Productive. Reliable. Fast.","fork":true,"url":"https://api.github.com/repos/lalo2302/phoenix","forks_url":"https://api.github.com/repos/lalo2302/phoenix/forks","keys_url":"https://api.github.com/repos/lalo2302/phoenix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lalo2302/phoenix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lalo2302/phoenix/teams","hooks_url":"https://api.github.com/repos/lalo2302/phoenix/hooks","issue_events_url":"https://api.github.com/repos/lalo2302/phoenix/issues/events{/number}","events_url":"https://api.github.com/repos/lalo2302/phoenix/events","assignees_url":"https://api.github.com/repos/lalo2302/phoenix/assignees{/user}","branches_url":"https://api.github.com/repos/lalo2302/phoenix/branches{/branch}","tags_url":"https://api.github.com/repos/lalo2302/phoenix/tags","blobs_url":"https://api.github.com/repos/lalo2302/phoenix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lalo2302/phoenix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lalo2302/phoenix/git/refs{/sha}","trees_url":"https://api.github.com/repos/lalo2302/phoenix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lalo2302/phoenix/statuses/{sha}","languages_url":"https://api.github.com/repos/lalo2302/phoenix/languages","stargazers_url":"https://api.github.com/repos/lalo2302/phoenix/stargazers","contributors_url":"https://api.github.com/repos/lalo2302/phoenix/contributors","subscribers_url":"https://api.github.com/repos/lalo2302/phoenix/subscribers","subscription_url":"https://api.github.com/repos/lalo2302/phoenix/subscription","commits_url":"https://api.github.com/repos/lalo2302/phoenix/commits{/sha}","git_commits_url":"https://api.github.com/repos/lalo2302/phoenix/git/commits{/sha}","comments_url":"https://api.github.com/repos/lalo2302/phoenix/comments{/number}","issue_comment_url":"https://api.github.com/repos/lalo2302/phoenix/issues/comments{/number}","contents_url":"https://api.github.com/repos/lalo2302/phoenix/contents/{+path}","compare_url":"https://api.github.com/repos/lalo2302/phoenix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lalo2302/phoenix/merges","archive_url":"https://api.github.com/repos/lalo2302/phoenix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lalo2302/phoenix/downloads","issues_url":"https://api.github.com/repos/lalo2302/phoenix/issues{/number}","pulls_url":"https://api.github.com/repos/lalo2302/phoenix/pulls{/number}","milestones_url":"https://api.github.com/repos/lalo2302/phoenix/milestones{/number}","notifications_url":"https://api.github.com/repos/lalo2302/phoenix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lalo2302/phoenix/labels{/name}","releases_url":"https://api.github.com/repos/lalo2302/phoenix/releases{/id}","deployments_url":"https://api.github.com/repos/lalo2302/phoenix/deployments","created_at":"2017-04-13T18:11:26Z","updated_at":"2017-04-13T18:11:29Z","pushed_at":"2017-04-14T19:47:47Z","git_url":"git://github.com/lalo2302/phoenix.git","ssh_url":"git@github.com:lalo2302/phoenix.git","clone_url":"https://github.com/lalo2302/phoenix.git","svn_url":"https://github.com/lalo2302/phoenix","homepage":"http://www.phoenixframework.org","size":6160,"stargazers_count":0,"watchers_count":0,"language":"Elixir","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"phoenixframework:master","ref":"master","sha":"f5061f113223acd6e2d94f52a3e6826b4c77e43a","user":{"login":"phoenixframework","id":6510388,"avatar_url":"https://avatars1.githubusercontent.com/u/6510388?v=3","gravatar_id":"","url":"https://api.github.com/users/phoenixframework","html_url":"https://github.com/phoenixframework","followers_url":"https://api.github.com/users/phoenixframework/followers","following_url":"https://api.github.com/users/phoenixframework/following{/other_user}","gists_url":"https://api.github.com/users/phoenixframework/gists{/gist_id}","starred_url":"https://api.github.com/users/phoenixframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phoenixframework/subscriptions","organizations_url":"https://api.github.com/users/phoenixframework/orgs","repos_url":"https://api.github.com/users/phoenixframework/repos","events_url":"https://api.github.com/users/phoenixframework/events{/privacy}","received_events_url":"https://api.github.com/users/phoenixframework/received_events","type":"Organization","site_admin":false},"repo":{"id":16072585,"name":"phoenix","full_name":"phoenixframework/phoenix","owner":{"login":"phoenixframework","id":6510388,"avatar_url":"https://avatars1.githubusercontent.com/u/6510388?v=3","gravatar_id":"","url":"https://api.github.com/users/phoenixframework","html_url":"https://github.com/phoenixframework","followers_url":"https://api.github.com/users/phoenixframework/followers","following_url":"https://api.github.com/users/phoenixframework/following{/other_user}","gists_url":"https://api.github.com/users/phoenixframework/gists{/gist_id}","starred_url":"https://api.github.com/users/phoenixframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phoenixframework/subscriptions","organizations_url":"https://api.github.com/users/phoenixframework/orgs","repos_url":"https://api.github.com/users/phoenixframework/repos","events_url":"https://api.github.com/users/phoenixframework/events{/privacy}","received_events_url":"https://api.github.com/users/phoenixframework/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/phoenixframework/phoenix","description":"Productive. Reliable. Fast.","fork":false,"url":"https://api.github.com/repos/phoenixframework/phoenix","forks_url":"https://api.github.com/repos/phoenixframework/phoenix/forks","keys_url":"https://api.github.com/repos/phoenixframework/phoenix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/phoenixframework/phoenix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/phoenixframework/phoenix/teams","hooks_url":"https://api.github.com/repos/phoenixframework/phoenix/hooks","issue_events_url":"https://api.github.com/repos/phoenixframework/phoenix/issues/events{/number}","events_url":"https://api.github.com/repos/phoenixframework/phoenix/events","assignees_url":"https://api.github.com/repos/phoenixframework/phoenix/assignees{/user}","branches_url":"https://api.github.com/repos/phoenixframework/phoenix/branches{/branch}","tags_url":"https://api.github.com/repos/phoenixframework/phoenix/tags","blobs_url":"https://api.github.com/repos/phoenixframework/phoenix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/phoenixframework/phoenix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/phoenixframework/phoenix/git/refs{/sha}","trees_url":"https://api.github.com/repos/phoenixframework/phoenix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/phoenixframework/phoenix/statuses/{sha}","languages_url":"https://api.github.com/repos/phoenixframework/phoenix/languages","stargazers_url":"https://api.github.com/repos/phoenixframework/phoenix/stargazers","contributors_url":"https://api.github.com/repos/phoenixframework/phoenix/contributors","subscribers_url":"https://api.github.com/repos/phoenixframework/phoenix/subscribers","subscription_url":"https://api.github.com/repos/phoenixframework/phoenix/subscription","commits_url":"https://api.github.com/repos/phoenixframework/phoenix/commits{/sha}","git_commits_url":"https://api.github.com/repos/phoenixframework/phoenix/git/commits{/sha}","comments_url":"https://api.github.com/repos/phoenixframework/phoenix/comments{/number}","issue_comment_url":"https://api.github.com/repos/phoenixframework/phoenix/issues/comments{/number}","contents_url":"https://api.github.com/repos/phoenixframework/phoenix/contents/{+path}","compare_url":"https://api.github.com/repos/phoenixframework/phoenix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/phoenixframework/phoenix/merges","archive_url":"https://api.github.com/repos/phoenixframework/phoenix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/phoenixframework/phoenix/downloads","issues_url":"https://api.github.com/repos/phoenixframework/phoenix/issues{/number}","pulls_url":"https://api.github.com/repos/phoenixframework/phoenix/pulls{/number}","milestones_url":"https://api.github.com/repos/phoenixframework/phoenix/milestones{/number}","notifications_url":"https://api.github.com/repos/phoenixframework/phoenix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/phoenixframework/phoenix/labels{/name}","releases_url":"https://api.github.com/repos/phoenixframework/phoenix/releases{/id}","deployments_url":"https://api.github.com/repos/phoenixframework/phoenix/deployments","created_at":"2014-01-20T14:14:11Z","updated_at":"2017-04-14T19:55:17Z","pushed_at":"2017-04-14T19:47:49Z","git_url":"git://github.com/phoenixframework/phoenix.git","ssh_url":"git@github.com:phoenixframework/phoenix.git","clone_url":"https://github.com/phoenixframework/phoenix.git","svn_url":"https://github.com/phoenixframework/phoenix","homepage":"http://www.phoenixframework.org","size":6159,"stargazers_count":9287,"watchers_count":9287,"language":"Elixir","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1096,"mirror_url":null,"open_issues_count":16,"forks":1096,"open_issues":16,"watchers":9287,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/phoenixframework/phoenix/pulls/2250"},"html":{"href":"https://github.com/phoenixframework/phoenix/pull/2250"},"issue":{"href":"https://api.github.com/repos/phoenixframework/phoenix/issues/2250"},"comments":{"href":"https://api.github.com/repos/phoenixframework/phoenix/issues/2250/comments"},"review_comments":{"href":"https://api.github.com/repos/phoenixframework/phoenix/pulls/2250/comments"},"review_comment":{"href":"https://api.github.com/repos/phoenixframework/phoenix/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/phoenixframework/phoenix/pulls/2250/commits"},"statuses":{"href":"https://api.github.com/repos/phoenixframework/phoenix/statuses/d847b63e32c56eace4d7bf6e2b830a567c9b8877"}}}}
{"actor":{"display_login":"kelvinst"}}