Reputation: 5990
I've got a problem with my previous question. Nobody can't help me so I'll try to write better this time what I want:
generators#show
view, and in this view I want to do
everything without refreshing page after clicking a button etc.@bigtable
, which is actually an array of strings<%= form_tag do %><%= submit_tag 'Save it' %><% end %>
@bigtable
array records.For couple days I think I've tried everything but I don't really understand how to solve it. Could someone, please write here what methods in model and controller I should write? And all required routes? I'll really appreciate any help. My previous thread (but please do not send me there or give same answers like there): saving file after passing parameter
Upvotes: 1
Views: 639
Reputation: 5990
finally I've found a solution:
def savefile
@generator = Generator.new(params[:generator])
@bigtable = Rails.cache.read("pass")
doc = "wyniki.csv"
File.open(doc, "w"){ |f| f << @bigtable}
send_file(doc, :type => 'text; charset=utf-8')
end
Upvotes: 3