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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
formatted_books_path(:format => "whatever_format_you_like") On Sat, Mar 14, 2009 at 7:31 PM, Brandon Olivares <programmer2188-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > 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 > > > > >-- Kaspars Bankovskis --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
you can also go rake routes to see a list of all available routes and formats. On Mar 14, 9:31 pm, Kaspars Bankovskis <kasp...-fgJ4dvhpd1Q@public.gmane.org> wrote:> formatted_books_path(:format => "whatever_format_you_like") > > On Sat, Mar 14, 2009 at 7:31 PM, Brandon Olivares > > > > <programmer2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > 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 > > -- > Kaspars Bankovskis--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---