Hi all I''m using RESTful routes combined with the to_csv plugin and would like to know if there''s a nicer way of generating a link to fetch the CSV file than just making a hard link. This is what I use for the moment (and it works btw): <%= link_to("Export as CSV","/companies.csv") -%> I would expect the link helper to have something like <%= link_to("Export as CSV",companies_url(:type => :csv) -%> but haven''t found anything in the rails docs to generate the URL in this way. Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 1/16/07, Peter De Berdt <peter.de.berdt-LPO8gxj9N8aZIoH1IeqzKA@public.gmane.org> wrote:> Hi all > > I''m using RESTful routes combined with the to_csv plugin and would like to > know if there''s a nicer way of generating a link to fetch the CSV file than > just making a hard link. This is what I use for the moment (and it works > btw): > > <%= link_to("Export as CSV","/companies.csv") -%> > > I would expect the link helper to have something like > > <%= link_to("Export as CSV",companies_url(:type => :csv) -%> > > but haven''t found anything in the rails docs to generate the URL in this > way.formatted_companies_url(:format => :csv) -- Rick Olson http://weblog.techno-weenie.net http://mephistoblog.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 16 Jan 2007, at 15:45, Rick Olson wrote:>> I''m using RESTful routes combined with the to_csv plugin and would >> like to >> know if there''s a nicer way of generating a link to fetch the CSV >> file than >> just making a hard link. This is what I use for the moment (and it >> works >> btw): >> >> <%= link_to("Export as CSV","/companies.csv") -%> >> >> I would expect the link helper to have something like >> >> <%= link_to("Export as CSV",companies_url(:type => :csv) -%> >> >> but haven''t found anything in the rails docs to generate the URL >> in this >> way. > > formatted_companies_url(:format => :csv)Thanks! Working perfectly, simple... but undocumented. Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---