Wednesday 15 August 2012

ruby - Rails routes helper not updating to new "match"ed route -


I have the "list" model and "controller lists" for it. By default, the path / list for lists / 1, / list / 1 / edit / etc. I changed my routes to change it. RB file therefore show path was "/: id", new path "/ new".

Here are my route files:

  ToDo :: Application.routes.draw To Route: 'pages # home' match '/ about', to: 'Page' for 'Page # Support' resources for 'match' / 'contact': 'Page: contact' match '/ help': matches '/ new': 'lists #new match' '/': 'List: # list' match '/' id / new ', to:' lists #new_item 'and   

I "localhost: 3000/1" absolutely fine. But now I'm trying to use link_to, and when I "list_to" list "list", it generates the URL on the original path, which is "localhost: 3000 / list / 1".

Does anyone know how to fix this? Is there anything that I should do better with my routes?

Thank you! Instead of using

match , you provide alternate paths for resources Can:

  resources: list, path: ''    

No comments:

Post a Comment