How do I duplicate a file stored in ActiveStorage in Rails 5.2 : <p>I have a model that is using ActiveStorage:</p>

<pre><code>class Package &lt; ApplicationRecord
  has_one_attached :poster_image
end
</code></pre>

<p>How do I create a copy of a Package object that contains a duplicate of the initial poster_image file. Something along the lines of:</p>

<pre><code>original = Package.first
copy = original.dup
copy.poster_image.attach = original.poster_image.copy_of_file
</code></pre>
