Hi there,
This seems to be obvious but after reading a few times the section in
the Agile Wb Dev with Rails I’m still strugling.
I have a table with categories names which I want to display in the url
instead of their id. So far I managed to get both in the url by adding:
map.connect ‘/:id/:category/’, :controller => “site”, :action => “show”
in the routes.rb file and calling the link in the view as below:
<%= link_to category.name, :action => ‘show’, :id => category, :category
=> category.name %>
I tried to take the id out of map.connect but then I get the error
message below as the controller is looking by id’s and not the category
name:
“Couldn’t find Category without an ID”
Should I modify the controller to look by the name parameter instead of
the id or am I missing something in the routes.rb file?
Anyone there who can help out?
Thanks a lot.