Skip to content

Routes Gotcha

December 18, 2008

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.

About these ads
One Comment leave one →
  1. Asyraf Abdul Rahman permalink
    January 21, 2009 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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: