I have a javascript file that uses ajax and passes an array of ids to a rails controller action. The controller then maps these to model objects and generates a file containing some of their data. My problem lies in downloading this file.
Before, I was saving the needed objects in the database first, and then the controller could just format as .ics, call the same action, then the file would be downloaded.
Now everything is more dynamic, and I'm having trouble rendering the file now that I have to pass in params. Is there a way to do this? I've tried
render :layout => false, :text => @calendar.to_ical
and
send_data @calendar.to_ical, :type=> 'text/ics'
and
render :text => @calendar.to_ical
All of which complete successfully, but no file is ever downloaded.
Any help would be appreciated! Thank you!