Question

How do I change a rails app so that a controller foo appears as the application root?

In other words, right now all the urls look like host.com/foo/... and I'd like to get rid of the foo and have simply host.com/...

Was it helpful?

Solution

In routes.rb, add:

map.root :controller => 'foo'

Full details in the API.

OTHER TIPS

In your routes.rb you add a named route like so:

map.home '', :controller => 'foo', :action => 'index'

This will build a route for when the root of web application is requested, it will use the foo controller and call the index action. Make sure you have it at the bottom so it is given the lowest priority.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top