Very often in a rails project, I have a ‘content’ controller that houses miscellaneous pages like the about us page and the contact us page and the intro page, etc.
I usually do something like
match '/content/:action', :controller => 'content'
in the routes.rb file, but I’m at a loss as to how to reference it inside my views.
What is the intended way to reference them?
Is it:
= link_to "Help", '/dashboard/help'
Or do I need to create a named route for each of these things?
No, you don’t need the named route, but it is the convention. You can do the following as well:
And in the routes file it would look like:
As long as you map it somehow, even doing
resources :dashboardit will work. For a little extra help here’s the guide on Routing in Rails. You can also list all your routes using therake routescommand and it will list the routes like so:Which means, in this case, you can use help_path, about_path and contact_path.