stubmbled across this message right after looking at this message.
http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/fea26c9c3c01ba93?pli=1
Maybe it will help you. Good Luck!
On Jan 13, 10:50 pm, Lin Wj
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> currently iam using FasterCSV to render csv pages
>
> format.csv do
> csv_string = FasterCSV.generate do |csv|
> # header row
> csv << @query_result[0].keys
>
> @query_result.each do |x|
> csv << x.values
> end
> end
> #send it to the browser
> send_data csv_string,
> :type => ''text/csv; charset=iso-8859-1;
header=present'',
> :disposition => "attachment;
filename=#{''data''}.csv"
> end
>
> i wanted to contain the "display codes" inside a view so i tried
using
> respond_to do |format|
> format.csv
> and having a matching show.csv.erb
>
> but i cant set the header information
> -> send_data csv_string,
> :type => ''text/csv; charset=iso-8859-1;
header=present'',
> :disposition => "attachment;
filename=#{''data''}.csv"
> inside the view itself
>
> anyway to do it ?
> --
> Posted viahttp://www.ruby-forum.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@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---