我无法使用服务对象中的 Active Storage 将 JSON Tempfile 附加到模型。这很容易复制:
模型:
class ServiceRequest < ApplicationRecord
has_one_attached :data_file
过程:
temp_file = Tempfile.new([SecureRandom.uuid, '.json'])
@service_request.data_file.attach(temp_file)
错误:
ActiveRecord::RecordNotSaved (Failed to save the new associated data_file_attachment.)
我在模型上data_file
定义为。不知道问题可能在这里。string
ServiceRequest