Hi,
Recently, I stepped into a problem while configuring routes to my
rails app.
I have a link_to tag like this:
link_to ‘healthyliving’, :controller => :resources, :action =>
:read_article, :path => ‘healthyliving’, :id => 1
to achieve a url format
“localhost:3000/resources/read_article/healthyliving/1”,
I have configured a route like this:
map.connect ‘:controller/:action/:path/:id’, :controller => ‘resources’,
:action => ‘read_article’
This works well when my :path parameter contains only a single phrase
like ‘healthyliving’ or ‘vitamins’ but fails with the following error:
“no route foound to match
/resources/read_article/healthyliving/vitamins/1” when the :path
contains a combination of phrases like ‘healthyliving/vitamins’ or
‘healthyliving/vitamins/something’ etc… which is a possible scenario.
I need a url format maintaining the exact :path sent from the link_to
tag.
for ex: when :path => ‘healthyliving/vitamins’, I would expect my url to
be
localhost:3000/resources/read_article/healthyliving/vitamins/1
How do I achieve this? Any help appreciated.
thanks.