Forum: Ruby on Rails How to add extension to routes?

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.
F85bacbbd4814799d4526b3e35a431df?d=identicon&s=25 Brandon Olivares (Guest)
on 2009-03-14 18:32
(Received via mailing list)
Hi,

I noticed that all routes have an alternative format ending in .:format.
I
tried this out, adding .html to some routes, and it worked.

But I wondered how you can add an extension like this automatically to
generated paths? For instance if I have a model named Book, and so a
route
named books_path, how can I get: /books.html?

Thanks,
Brandon
F03bd1ef0e81c6d28876efceaa290662?d=identicon&s=25 Kaspars Bankovskis (Guest)
on 2009-03-14 21:31
(Received via mailing list)
formatted_books_path(:format => "whatever_format_you_like")

On Sat, Mar 14, 2009 at 7:31 PM, Brandon Olivares
<programmer2188@gmail.com> wrote:
> Thanks,
> Brandon
>
>
> >
>



--
Kaspars Bankovskis
872535e214a9e3a98889bd8d069f0294?d=identicon&s=25 "Wolas!" (Guest)
on 2009-03-16 12:44
(Received via mailing list)
you can also go rake routes to see a list of all available routes and
formats.
This topic is locked and can not be replied to.