PDA

View Full Version : Setting a Default Controller and Action


rob
August 12th, 2005, 04:51 PM
To set the default index page of your app, you'll need to first delete the index.html file that comes with Rails.

Once you've done this, edit the file config/routes.rb in a text editor and find this:
# map.connect '', :controller => "welcome"
Remove the comment (the "#" sign) and change the controller (specified here by welcome) to the controller you want to set as the default. Also, you can add :action => 'youraction' (replace youraction with the default action of that controller) to specify an action to do in that controller.
That's all there is to it!

peta
September 3rd, 2006, 09:38 AM
Hi well I have just done exactly what you decribed above, and I got this.

The path to the developent is www.euskalaretoa.com/rails01

Bad Request
Your browser sent a request that this server could not understand.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

obviously I have not as yet started to write any code, I just want to make sure that everything is set up correctly... given that I have renamed the default index file, so effectively it's not there, is the above the expected response, I kind of thought it would say "welcome", or something.

Sorry to be such a beginner, but I want to make sure that the development environment is 'bang on' before I launch myslef into my project, and I need to get on with it =8?)