Forum: Ruby on Rails How can I set default 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.
farocco (Guest)
on 2005-12-07 16:12
(Received via mailing list)
Hello,

I get to my app by:

http://web:8082/receipts/receipt

I would like the same page to come up if I type:
http://web:8082/receipts

How can I do this?

Thanks

Frank
nicholas.stuart (Guest)
on 2005-12-07 16:21
(Received via mailing list)
Add a method in your receipts controller called index and have it look
like:

def index
   receipt
   render :action => "receipt"
end

Should do the trick.
hypsometry (Guest)
on 2005-12-07 16:29
(Received via mailing list)
On 12/7/05, Frank <removed_email_address@domain.invalid> wrote:
> I get to my app by:
>
> http://web:8082/receipts/receipt
>
> I would like the same page to come up if I type:
> http://web:8082/receipts

In config/routes.rb put something like:

map.connect 'receipts', :controller => 'receipts', :action => 'receipt'

Yikes -- 'receipt' is one of those words that after looking at it too
much it goes all funny in my head and starts looking like alien
gibberish...

--
Chris B.

http://hypsometry.com/  :  website edification
http://uvlist.org/  :  free classifieds for the Upper Valley
farocco (Guest)
on 2005-12-07 16:29
(Received via mailing list)
Thanks  for the help and the laugh....

Frank
----- Original Message -----
From: "Chris B." <removed_email_address@domain.invalid>
To: <removed_email_address@domain.invalid>
Sent: Wednesday, December 07, 2005 9:25 AM
Subject: Re: [Rails] How can I set default page?


> map.connect 'receipts', :controller => 'receipts', :action => 'receipt'
>
--------------------------------------------------------------------------------
virgild (Guest)
on 2005-12-07 16:33
(Received via mailing list)
You can use Rails' routing mechanism to do some url rewriting. The
app/config/routes.rb file contains your app's routing information. On
your
example, you can try the following route:

map.connect 'receipts', :controller => 'Receipts', :action => 'receipt'

That is, assuming that your /receipts/receipt link pertains to the
receipt
action of your ReceiptController.
You can read more about routing here:
http://manuals.rubyonrails.com/read/book/9.

"Frank" <removed_email_address@domain.invalid> wrote in message
news:002001c5fb37$fd3aa820$removed_email_address@domain.invalid...
Hello,

I get to my app by:

http://web:8082/receipts/receipt

I would like the same page to come up if I type:
http://web:8082/receipts

How can I do this?

Thanks

Frank



_______________________________________________
Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails
This topic is locked and can not be replied to.