Difficulty with send_data in Ruby on Rails in conjunction with Spreadsheet plug-in

后端 未结 2 1138
一个人的身影
一个人的身影 2021-01-02 18:11

I have a function in a controller that takes in some specifications and generates a report on them. This function user_report is called in a view:

< %= submit_to

2条回答
  •  一整个雨季
    2021-01-02 18:30

    Just change the line:

    send_data data.string, :type=>"application/excel", :disposition=>'attachment', :filename => @outfile
    

    to:

    send_data data.string.bytes.to_a.pack("C*"), :type=>"application/excel", :disposition=>'attachment', :filename => @outfile
    

提交回复
热议问题