I have created a direct upload form and that works great. The pdfs get uploaded and added to activestorage. however, I now wish to create another record which relates to only one of the uploaded files. (so a company sends in many pdfs with jobs, i want to create a workorder for a workman with just one of the jobs)
class Jobqueue < ApplicationRecord
has_many_attached :attachments
has_many :workorders;
end
class Workorder < ApplicationRecord
belongs_to :Jobqueue, :company, :workman
has_attached :attachment
end
In the create method of the Jobqueue, i was thinking of replicating the record that’s in the active_record_attachments table, and substituting the Jobqueue record type for Workorder using sql, but it doesn’t seem the railsy way to do it Any help most welcome