How can I set default page?

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

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.

On 12/7/05, Frank [email protected] 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

Thanks for the help and the laugh…

Frank
----- Original Message -----
From: “Chris B.” [email protected]
To: [email protected]
Sent: Wednesday, December 07, 2005 9:25 AM
Subject: Re: [Rails] How can I set default page?

map.connect ‘receipts’, :controller => ‘receipts’, :action => ‘receipt’


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” [email protected] wrote in message
news:[email protected]
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
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs