Need a Rails route with a possible period in the :id, but also retain the optional :format

Viewed 7572

I have a Rails route that takes stock ticker symbols as the :id

  • feeds/AMZN will return a page for Amazon
  • feeds/AMZN.csv will return a CSV representation of the same data.

But I also need to accomodate stocks like VIA.B (Viacom) so that both of these routes work:

feeds/VIA.B (html)
feeds/VIA.B.csv (csv)

Is this possible? How would I set the routing up?

3 Answers
Related