title: How to add JSON file export functionality in Rails 4.2
body: <p>So i am interested in writing a method that when i click an export button, certain data from the db at exported to JSON data.</p>
  
  <p>How can i do that?</p>
  
  <p>The procedure is this</p>
  
  <pre><code>get data from db -&gt; convert to json -&gt; write to file -&gt; save file to computer.
  </code></pre>
  
  <p>thanks</p>