title: Writing string to file for download Ruby on Rails
body: <p>I am building an application that makes a lot of API calls. I would like to be able to write the output of each API call to a file and then be able to download that file. So far this is what my controller looks like:</p>
  <pre><code>def show
     @resp = Faraday.get(&quot;https://my_api_endpoint&quot;)
  end 
  </code></pre>
  <p>How can I write a string to a file and download that file with Ruby on Rails?</p>