Forum: Ruby on Rails homepage instead of welcome page?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2da252cc1d2fb3701126171831b50a65?d=identicon&s=25 Dave Coleman (pezdude)
on 2006-02-07 16:27
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
119af50160cabfe1fb6f2f05f5018c64?d=identicon&s=25 James Ludlow (Guest)
on 2006-02-07 16:55
(Received via mailing list)
On 2/7/06, David C. <dave@pezians.com> 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
2da252cc1d2fb3701126171831b50a65?d=identicon&s=25 Dave Coleman (pezdude)
on 2006-02-07 16:57
> map.connect '/', :controller => 'mycontroller', :action => 'someaction'

Thanks, I'll try that tonight!
9b7647d55df4584d7031130915556040?d=identicon&s=25 Will Briggs (Guest)
on 2006-02-07 17:04
(Received via mailing list)
>
>
>
> 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
A43430351a6d4fb6d61d000bd56ed19a?d=identicon&s=25 Francois Paul (Guest)
on 2006-02-07 17:04
(Received via mailing list)
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"
5d15c6821f3c3054c04b85471824ba7c?d=identicon&s=25 Mikkel Bruun (Guest)
on 2006-02-07 19:25
(Received via mailing list)
>>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 Bruun

www.strongside.dk    - Football Portal(DK)
nflfeed.helenius.org - Football News(DK)
ting.minline.dk      - Buy Old Stuff!(DK)
This topic is locked and can not be replied to.