I tried using ActiveStoragewith one attachment. I was able to download the attachment.
My problem is creating the url. I useurl_for
class Template < ApplicationRecord
acts_as_archival readonly_when_archived: true
before_archive
belongs_to :user
has_many :fields, dependent: :destroy
accepts_nested_attributes_for :fields, allow_destroy: true
has_many :contracts
has_one_attached :image
end
<%= url_for(@template.image) %>
I have this error
undefined method `active_storage_attachment_path' for
source
share