Routes Gotcha

2008 December 18
by Fadhli

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.

One Response leave one →
  1. 2009 January 21
    Asyraf Abdul Rahman permalink

    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

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS