Got a noob question for ya... When I visit http://localhost:3000/ I get the nice "Welcome to rails" page. To get to a controller I have to go to: http://localhost:3000/controllername What if I don't want the welcome message and want / to resolve to a controller? How do I set that up? Thanks, Dave
on 2006-02-07 17:27
on 2006-02-07 17:55
On 2/7/06, David C. <firstname.lastname@example.org> wrote: > How do I set that up? One way to do it is to define a route for '/'. As the last entry in routes.rb, add something like this: map.connect '/', :controller => 'mycontroller', :action => 'someaction' You'll have to get rid of index.html in the /public directory or that file will show instead. I don't really understand why index.html gets shown in that case, so if someone could explain that piece of it I'd appreciate it. -- James
on 2006-02-07 17:57
> map.connect '/', :controller => 'mycontroller', :action => 'someaction' Thanks, I'll try that tonight!
on 2006-02-07 18:04
> > > > You'll have to get rid of index.html in the /public directory or that > file will show instead. I don't really understand why index.html gets > shown in that case, so if someone could explain that piece of it I'd > appreciate it. > Because Rails uses 404 rerouting to work, at least in most of the set-ups I've seen... if the file exists (in this case. index.html) it gets shown - if it doesn't exist, the URL is passed as a 404 to the (F/S)CGI script, which looks at the URL, compares it to routes.rb, and picks the correct controller and action to run. -Will
on 2006-02-07 18:04
first you have to delete the index.html file in you application's public directory. then you edit the routes.rb file and create a route that reads like the following: map.connect '', :controller => "controller_name"
on 2006-02-07 20:25
>>What if I don't want the welcome message and want / to resolve to a >>controller? >> >>How do I set that up? Did you read the welcome message??? qoute: Set up a default route and remove or rename this file ;-) Mikkel B. www.strongside.dk - Football Portal(DK) nflfeed.helenius.org - Football News(DK) ting.minline.dk - Buy Old Stuff!(DK)