My routes.rb file:
resources :forums do
resources :discussions,
end
I have my project all setup and working, the URL for a forum topic is:
localhost:3000/forums/ - (forum name using permalink) - /topics/1
I would like to replace this with a slightly easier version:
localhost:3000/forums/ - (forum name using permalink) - /1
Basically, removing the ‘topics’ portion from the URL and disabling ‘/topics’ completely – so that it can’t be accessed.
I have setup the show page of a forum to display a list of its topics. What’s the best way to go about achieving this? Many thanks in advance!
You need to add a route to your
config/routes.rb.In my eyes the easiest would be to define a default route for
/forums/general-chat.To disable the old route with topics in:
The rails routing guide is great!