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 Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
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 <farocco-H+0wwilmMs3R7s880joybQ@public.gmane.org> wrote:> > 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 > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
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" <farocco-H+0wwilmMs3R7s880joybQ@public.gmane.org> wrote in message news:002001c5fb37$fd3aa820$29140a0a-J3C02bkCjkcYufhmsgKqqQ@public.gmane.org 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 Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 12/7/05, Frank <farocco@verizon.net> 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/receiptsIn 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 Boone http://hypsometry.com/ : website edification http://uvlist.org/ : free classifieds for the Upper Valley _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Thanks for the help and the laugh.... Frank ----- Original Message ----- From: "Chris Boone" <hypsometry-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> To: <rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org> Sent: Wednesday, December 07, 2005 9:25 AM Subject: Re: [Rails] How can I set default page?> On 12/7/05, Frank <farocco-H+0wwilmMs3R7s880joybQ@public.gmane.org> 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 Boone > > http://hypsometry.com/ : website edification > http://uvlist.org/ : free classifieds for the Upper Valley >--------------------------------------------------------------------------------> _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >