ActiveStorage::FileNotFoundError inside a rails transaction

Viewed 178

I want to use a transaction in two steps on my rails app that uses dry-monads

process = yield create_process
yield create_file(process)

def create_file
  myobject.file.attach(io: file['tempfile'], filename: file['filename'], content_type: file['type'])
  CSV.parse(myobject.file.download.force_encoding('UTF-8'), headers: true)

This works, but if I use a transaction to wrap the two steps

Process.transaction do
  process = yield create_process
  yield create_file(process)
end

I am getting an error ActiveStorage::FileNotFoundError

0 Answers
Related