root path for multiple controllers on rails routes

Posted by Lee on Stack Overflow See other posts from Stack Overflow or by Lee
Published on 2012-03-31T10:17:29Z Indexed on 2012/04/07 5:28 UTC
Read the original article Hit count: 170

I have two resource controllers where I am using a slug to represent the ID. (friendly_id gem).

I am able to have the show path for one resource on the route but not for two at the same time. ie.

root :to => 'home#index'
match '/:id' => "properties#show"
match '/:id' => "contents#show"

Basically I want urls like,

# Content
domain.com/about-us
domain.com/terms
# Property
domain.com/unique-property-name
domain.com/another-unique-property-name

Whatever resource I put on top works. Is there a way to do this?

Thanks in advace if you can help.

© Stack Overflow or respective owner

Related posts about ruby-on-rails-3

Related posts about ruby-on-rails-3.1