Forum: Ruby on Rails RESTful routes and Mime::Type

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.
00973881979aa0a660ffbbb2f7a907fb?d=identicon&s=25 Peter De Berdt (Guest)
on 2007-01-16 14:54
(Received via mailing list)
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
821395fe70906c8290df7f18ac4ac6cf?d=identicon&s=25 Rick Olson (Guest)
on 2007-01-16 15:46
(Received via mailing list)
On 1/16/07, Peter De Berdt <peter.de.berdt@pandora.be> wrote:
>
> <%= 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
00973881979aa0a660ffbbb2f7a907fb?d=identicon&s=25 Peter De Berdt (Guest)
on 2007-01-16 16:05
(Received via mailing list)
On 16 Jan 2007, at 15:45, Rick Olson wrote:

>> 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
This topic is locked and can not be replied to.