instance method
attach!
Ruby on Rails edge
Since edgeSignature
attach!(*attachables)
Calls attach, and raises an exception if the record was meant to be saved but at least one of the validations failed.
“‘ document.images.attach!(params) # Array of ActionDispatch::Http::UploadedFile objects document.images.attach!(params) # Signed reference to blob from direct upload document.images.attach!(io: File.open(“/path/to/racecar.jpg”), filename: “racecar.jpg”, content_type: “image/jpeg”) document.images.attach!([ first_blob, second_blob ]) “`
Parameters
-
attachablesrest
Source
# File activestorage/lib/active_storage/attached/many.rb, line 70
def attach!(*attachables)
attach(*attachables) || raise(ActiveRecord::RecordNotSaved.new("Failed to save the record", record))
end
Defined in activestorage/lib/active_storage/attached/many.rb line 70
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveStorage::Attached::Many