Routes Gotcha

Something peculiar happened when I was doing something trivial.

If you accidently named your restful route the following

resource :roles instead of resources :roles

When you point your app to /roles it won’t go to your index controller action but it will instead call your show action.

Tags: , ,

One Response to “Routes Gotcha”

  1. Asyraf Abdul Rahman 21. Jan, 2009 at 5:30 am #

    it’s got to do with has_many and has_one.

    if you do has_one, then your routes should use map.resource

    if you do has_many, then your routes should use map.resources

    rails is language specific :)

Leave a Reply