Topic: Where is the default view?

Let me apologize in advance, because I'm going to explain my question poorly, I think.

So, when I make a controller, it is accessible at www.site.com/controller.  But most people want the root of their website (www.site.com) to be the main page of their website.  How is this done?    The html page that shows on a default rails application says this page needs to be removed or a route needs to be added.  Where is the default view?  All views have a corresponding controller, but if I make a controller then it will be at www.site.com/controller, which is not what I want.  Do people just make a redirect page or use routes or .htaccess or whatever to forward everyone from www.site.com to www.site.com/mainpage?  The question I'm asking is so basic that I'm sure I'm just missing something, but I've played around a bit and can't seem to figure it out.

Re: Where is the default view?

Once you have created a controller, you can configure your routes to use that controller for the default main page. Edit your config/routes.rb file and add this line:

map.home '', :controller => 'my_controller'

Replace my_controller with the controller you want to use, then restart the web server. Hope that helps.

Railscasts - Free Ruby on Rails Screencasts

Re: Where is the default view?

Ah, so that's how everyone does it?  They just pick a controller to be the default one?  Of course it would be that simple.

Re: Where is the default view?

mixmanner wrote:

Ah, so that's how everyone does it?  They just pick a controller to be the default one?  Of course it would be that simple.

Or replace index.html in /public/ if you only need static content.

vinnie - rails forum admin