From: Anil Bhat Date: 2007-11-14T15:05:03+09:00 Subject: Re: Read file into array On Nov 14, 9:05 am, Phrogz wrote: > On Nov 13, 6:58 pm, Brian Scott wrote: > > > What are examples of reading a csv file (Comma) into an Array > > On the Internet. May be the following code will help you: def member_data member = Member.find(:all) stream_csv do |csv| csv << ["First Name","Last Name","Email"] member.each do |u| csv << [u.first_name,u.last_name,u.email] end end end Explanation: Member is the model name. First name, last name and email are the fields shown while downloading CSV. Following code to be written in rhtml file: <%= link_to 'download', :controller => 'reports', :action => 'member_data' %>