Im also facing the same problem ....

when i click on download a file with data is getting stored in the tmp/
folder where as in client side it is downloading 1 byte file.(empty
file)

def exporting_data
@list = User.find(:all)
FasterCSV.open("/home/ajit/Projects/xsampleapps/tmp/exports/your_data.csv",
"w+") do |csv|
csv << ["Name","Age" ]
@list.each do |record|
csv << [record.name, record.age]
end
end


send_file
'/home/ajit/Projects/xsampleapps/tmp/exports/your_data.csv',
:type => 'application/csv',
:x_sendfile => true
end

--
Posted via http://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@googlegroups.com.
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.

Search Discussions

  • Frederick Cheung at Dec 12, 2011 at 10:49 am

    On Dec 12, 9:49 am, Ajit Teli wrote:
    Im also facing the same problem ....

    when i click on download a file with data is getting stored in the tmp/
    folder where as in client side it is downloading 1 byte file.(empty
    file)

    def exporting_data
    @list = User.find(:all)
    FasterCSV.open("/home/ajit/Projects/xsampleapps/tmp/exports/your_data.csv",
    "w+") do |csv|
    csv << ["Name","Age" ]
    @list.each do |record|
    csv << [record.name, record.age]
    end
    end

    send_file
    '/home/ajit/Projects/xsampleapps/tmp/exports/your_data.csv',
    :type => 'application/csv',
    :x_sendfile => true
    end
    Have you setup xsendfile (installed the apache module & configured
    it) ? If you haven't then don't use the x_sendfile option

    Fred

    --
    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@googlegroups.com.
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedDec 12, '11 at 9:49a
activeDec 12, '11 at 10:49a
posts2
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Ajit Teli: 1 post Frederick Cheung: 1 post

People

Translate

site design / logo © 2022 Grokbase