This project is archived and is in readonly mode.
Singular Resource mapping to plural controller in rails 3
-
Jeff Kreeftmeijer
- State changed from new to invalid
- Importance changed from to Low
No, that's not a bug. Controllers are always plural, singular routes are just a way to route to without having to specify an ID. Check out the Routing guide:
Because you might want to use the same controller for a singular route (/account) and a plural route (/accounts/45), singular resources map to plural controllers.
Marking this as invalid, thanks for letting us know though. :)
-
inetufo
Thanks for the reply, but in my situation, a user just has one wall.I mean the url is like http://xxx/user/:user_id/wall, and will never be http://xxx/user/:user_id/wall/:id, the "wall" contoller is just used to show something just like comments to a user, and will never have an id param.Howerver, i changed the controller name to WallsController, and it works, but it looks a little weird...Any other way to write this?
-
inetufo
I found a solution already by specifying the :controller param
resources :users do
resource :wall, :controller => "wall" do
post :add_commentend end