I am looking for a way to easily open an external url in my rails 4 controller.
Right now, I have this in my controller:
def download_file
require 'Launchy'
surveys = FluidsurveysSurvey.where("name like '%#{params[:string_to_search_for]}%'")
surveys.each do |survey|
Launchy.open("https://fluidsurveys.com/api/v2/surveys/#{survey.fs_id}/csv/?_created_at>#{params[:start_date]}&_created_at<#{params[:end_date]}")
end
redirect_to responses_path
end
Locally, this works fine. I can run my server in development, and it will open each url in separate tab as it should.
However, when I push to Heroku, the code doesn't work. It errors with this:
LoadError (cannot load such file -- Launchy):
What can I do to either use Launchy in production, or open an external url via another method?