In the last we generated a useful link for our mail.
generate an real url with rails for an e-mail
This works fine, very fine. But we want to call the shoe-action 🙂
<%=link_to('Link', :controller => 'mycontroller', :action => 'show', :id => @mycontroller.id )%>
The url looks so
http://localhost:3000/mycontroller/show/10
we need this structure
http://localhost:3000/mycontroller/10
The rake routes command said this
mycontroller GET /mycontroller/:id(.:format) mycontroller#show
How do we get the needed structure? Do we need to edit our routes, or is there another way to get the right url?
Try to use the route helper
instead the {:controller => …, :action => …}
your link_to helper should look like this for better example i use the user show action
rake routes return this
and now I know I can use the user_url(@user) helper