Skip to content

Instantly share code, notes, and snippets.

@hrysd
Created November 11, 2012 06:39
Show Gist options
  • Select an option

  • Save hrysd/4053973 to your computer and use it in GitHub Desktop.

Select an option

Save hrysd/4053973 to your computer and use it in GitHub Desktop.
resources :users do
  get 'hoge' # 1
  get ':id/hoge' # 2
end
resources :users do
  collection do
    get ':id/hoge' # 3
    get ':id/hoge' => 'users#hoge' # 4
  end
end

結果

1. GET    /users/:user_id/login(.:format)     users#login
2. GET    /users/:user_id/:id/login(.:format) users#login
3. GET    /users/:id/login(.:format)          users/:id#login
4. GET    /users/:id/login(.:format)          users#login
@hrysd
Copy link
Author

hrysd commented Nov 11, 2012

:user_id

みたいに渡すのをなんとなくをやめたかったのです。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment