Very Noob Question: index.html

Hi --

Hi,

I have a very noob question. I just started on RoR this week, glad to be
on board.

Welcome!

I'm just wondering where I edit the first page when people
come to the site, index.html. There seems to be one in the public
folder. However, how do I make that a dynamic page?

Rails uses its routing system to figure out what to do given a
particular URL. That applies even when the URL is empty: you have to
register a routing rule that says what to do in response to the empty
URL.

To do this, look inside the file config/routes.rb. You'll see a
section like this:

   # You can have the root of your site routed by hooking up ''
   # -- just remember to delete public/index.html.
   # map.connect '', :controller => "welcome"

You want to uncomment the third line, and customize it to correspond
to whatever controller/action combo you want triggered by the empty
URL. (The action defaults to "index", so the example above triggers
the index action of the welcome controller.)

So a typical case might look like:

   map.connect '', :controller => "main", :action => "top"

or

   map.connect '', :controller => "main" # default to "index" action

etc.

And, like it says, don't forget to delete public/index.html :slight_smile:

David