Rails Routes Mappings

Posted by rdasxy on Stack Overflow See other posts from Stack Overflow or by rdasxy
Published on 2012-04-10T05:04:07Z Indexed on 2012/04/10 5:29 UTC
Read the original article Hit count: 113

Filed under:
|

I'm a rails newbie, and I have a controller called resource_links that I've mapped to resources:

resources :resources, :as => :resource_links, :controller => :resource_links

And this works (basically /resources works as /resource_links). However, trying to go to /resources/tags does not work. To get around this, I added more mappings as:

  match 'resource_links/tag/:tag(.:format)' => 'resource_links#tag', :via => :get, :as => 'resource_links_tagged', :constraints => {:tag => /.*/}
  match 'resource_links/tags' => 'resource_links#tags', :via => :get, :as => 'resource_links_tags'

Is there any way I can get /resources/tags to be mapped to /resource_links/tag?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about routes