title: Rails 5.2 Rest API + Active Storage - Upload file blob received from an external service
body: <p>We are receiving a POST call from an external service, which contains the file blob (in Base64 encoding), and some other parameters. </p>
  
  <pre><code># POST call to /document/:id/document_data
  param = {
      file: &lt;base64 encoded file blob&gt;
  }
  </code></pre>
  
  <p>We would want to process the file and upload it to the following model</p>
  
  <pre><code># MODELS
  # document.rb  
  class Document &lt; ApplicationRecord
      has_one_attached :file
  end
  </code></pre>