# How can I set default page?

**URL:** <https://www.ruby-forum.com/t/how-can-i-set-default-page/49674>\
**Category:** Rails\
**Created:** [December 7, 2005, 3:12pm UTC](https://www.ruby-forum.com/t/how-can-i-set-default-page/49674 "2005-12-07T15:12:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![farocco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f08c70/32.png) [@farocco](https://www.ruby-forum.com/u/farocco)\
**Post date:** [December 7, 2005, 3:12pm UTC](https://www.ruby-forum.com/t/how-can-i-set-default-page/49674/1 "2005-12-07T15:12:49Z")

</div>

Hello,

I get to my app by:

[http://web:8082/receipts/receipt](http://web:8082/receipts/receipt)

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

How can I do this?

Thanks

Frank

---

<div class="post-metadata">

**Author:** ![farocco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f08c70/32.png) [@farocco](https://www.ruby-forum.com/u/farocco)\
**Post date:** [December 7, 2005, 3:21pm UTC](https://www.ruby-forum.com/t/how-can-i-set-default-page/49674/2 "2005-12-07T15:21:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![farocco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f08c70/32.png) [@farocco](https://www.ruby-forum.com/u/farocco)\
**Post date:** [December 7, 2005, 3:29pm UTC](https://www.ruby-forum.com/t/how-can-i-set-default-page/49674/3 "2005-12-07T15:29:13Z")

</div>

On 12/7/05, Frank [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I get to my app by:
> 
> [http://web:8082/receipts/receipt](http://web:8082/receipts/receipt)
> 
> I would like the same page to come up if I type:  
> [http://web:8082/receipts](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/](http://hypsometry.com/) : website edification  
[http://uvlist.org/](http://uvlist.org/) : free classifieds for the Upper Valley

---

<div class="post-metadata">

**Author:** ![farocco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f08c70/32.png) [@farocco](https://www.ruby-forum.com/u/farocco)\
**Post date:** [December 7, 2005, 3:29pm UTC](https://www.ruby-forum.com/t/how-can-i-set-default-page/49674/4 "2005-12-07T15:29:14Z")

</div>

Thanks for the help and the laugh…

Frank  
----- Original Message -----  
From: “Chris B.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: [removed\_email\_address@domain.invalid](mailto: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’

* * *

---

<div class="post-metadata">

**Author:** ![farocco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f08c70/32.png) [@farocco](https://www.ruby-forum.com/u/farocco)\
**Post date:** [December 7, 2005, 3:33pm UTC](https://www.ruby-forum.com/t/how-can-i-set-default-page/49674/5 "2005-12-07T15:33:22Z")

</div>

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:  
[Peak Obsession](http://manuals.rubyonrails.com/read/book/9).

“Frank” [removed\_email\_address@domain.invalid](mailto: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](http://web:8082/receipts/receipt)

I would like the same page to come up if I type:  
[http://web:8082/receipts](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](http://lists.rubyonrails.org/mailman/listinfo/rails)
