{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/18855","labels_url":"https://api.github.com/repos/rails/rails/issues/18855/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/18855/comments","events_url":"https://api.github.com/repos/rails/rails/issues/18855/events","html_url":"https://github.com/rails/rails/issues/18855","id":56966059,"number":18855,"title":"Custom param routing behaviour seems not correct","user":{"login":"jvanbaarsen","id":1362793,"avatar_url":"https://avatars.githubusercontent.com/u/1362793?v=3","gravatar_id":"","url":"https://api.github.com/users/jvanbaarsen","html_url":"https://github.com/jvanbaarsen","followers_url":"https://api.github.com/users/jvanbaarsen/followers","following_url":"https://api.github.com/users/jvanbaarsen/following{/other_user}","gists_url":"https://api.github.com/users/jvanbaarsen/gists{/gist_id}","starred_url":"https://api.github.com/users/jvanbaarsen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvanbaarsen/subscriptions","organizations_url":"https://api.github.com/users/jvanbaarsen/orgs","repos_url":"https://api.github.com/users/jvanbaarsen/repos","events_url":"https://api.github.com/users/jvanbaarsen/events{/privacy}","received_events_url":"https://api.github.com/users/jvanbaarsen/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rails/rails/labels/stale","name":"stale","color":"444444"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-02-08T20:24:51Z","updated_at":"2015-08-25T05:39:37Z","closed_at":"2015-08-25T05:39:36Z","body":"WhenI was working on an app I noticed the `param` keyword for a route returns behaviour that I was not expecting.\r\n\r\nLets say I have the following route:\r\n```ruby\r\nresources :profiles, :param => :username do\r\n  get :details, :on => :member\r\n  resources :messages\r\nend\r\n```\r\n\r\nAnd when I call the url: `get '/profiles/bob/messages/34'` I expect the username to be in the `params[:username]`. But instead it's in the `params[:profile_username]`. When I looked at the testcase the behaviour seems to be planned, since there was a testcase written for it :\r\n\r\n```ruby\r\n  def test_custom_param\r\n    draw do\r\n      resources :profiles, :param => :username do\r\n        get :details, :on => :member\r\n        resources :messages\r\n      end\r\n    end\r\n\r\n    get '/profiles/bob'\r\n    assert_equal 'profiles#show', @response.body\r\n    assert_equal 'bob', @request.params[:username]\r\n\r\n    get '/profiles/bob/details'\r\n    assert_equal 'bob', @request.params[:username]\r\n\r\n    get '/profiles/bob/messages/34'\r\n    assert_equal 'bob', @request.params[:profile_username]\r\n    assert_equal '34', @request.params[:id]\r\n  end\r\n```\r\n\r\nI was wondering if this behaviour is correct, or that it would be more logical to in this case always have the `params[:username]` there instead of `profile_username`. Since that way it would be possible to guess the param name.\r\n\r\nLooking forward hearing from what you think!\r\n"},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/134487212","html_url":"https://github.com/rails/rails/issues/18855#issuecomment-134487212","issue_url":"https://api.github.com/repos/rails/rails/issues/18855","id":134487212,"user":{"login":"rails-bot","id":7468109,"avatar_url":"https://avatars.githubusercontent.com/u/7468109?v=3","gravatar_id":"","url":"https://api.github.com/users/rails-bot","html_url":"https://github.com/rails-bot","followers_url":"https://api.github.com/users/rails-bot/followers","following_url":"https://api.github.com/users/rails-bot/following{/other_user}","gists_url":"https://api.github.com/users/rails-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/rails-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails-bot/subscriptions","organizations_url":"https://api.github.com/users/rails-bot/orgs","repos_url":"https://api.github.com/users/rails-bot/repos","events_url":"https://api.github.com/users/rails-bot/events{/privacy}","received_events_url":"https://api.github.com/users/rails-bot/received_events","type":"User","site_admin":false},"created_at":"2015-08-25T05:39:37Z","updated_at":"2015-08-25T05:39:37Z","body":"This issue has been automatically closed because of inactivity.\n\nIf you can still reproduce this error on the `4-2-stable`, `4-1-stable` branches or on `master`,\nplease reply with all of the information you have about it in order to keep the issue open.\n\nThank you for all your contributions.\n"}}