Module: RactorRailsShim::ActiveStorageAttachedPatch::BlobBuildPatch
- Defined in:
- lib/ractor_rails_shim/patches/active_storage.rb
Overview
ActiveStorage::Blob.build_after_unfurling is implemented as
new(...).tap do |blob| blob.unfurl(io, identify: identify) end. The
tap block is compiled in the main Ractor and is un-shareable, so a
worker that creates a blob raises "defined with an un-shareable Proc in a
different Ractor". Reimplement with the same (all-keyword) signature but
without a block.
Instance Method Summary collapse
Instance Method Details
#build_after_unfurling(key: nil, io:, filename:, content_type: nil, metadata: nil, service_name: nil, identify: true, record: nil) ⇒ Object
67 68 69 70 71 |
# File 'lib/ractor_rails_shim/patches/active_storage.rb', line 67 def build_after_unfurling(key: nil, io:, filename:, content_type: nil, metadata: nil, service_name: nil, identify: true, record: nil) blob = new(key: key, filename: filename, content_type: content_type, metadata: , service_name: service_name) blob.unfurl(io, identify: identify) blob end |