How can I set default page?


#1

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


#2

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.


#3

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


#4

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’



#5

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