Active Storage Variant With Record
Like an ActiveStorage::Variant, but keeps detail about the variant in the database as an ActiveStorage::VariantRecord. This is only used if ActiveStorage.track_variants is enabled.
Attributes
| [R] | blob | |
| [R] | variation |
Class Public methods
new(blob, variation) Link
Source: show
# File activestorage/app/models/active_storage/variant_with_record.rb, line 11 def initialize(blob, variation) @blob, @variation = blob, ActiveStorage::Variation.wrap(variation) end
Instance Public methods
destroy() Link
Destroys record and deletes file from service.
Source: show
# File activestorage/app/models/active_storage/variant_with_record.rb, line 33 def destroy record&.destroy end
image() Link
Source: show
# File activestorage/app/models/active_storage/variant_with_record.rb, line 28 def image record&.image end
process() Link
Source: show
# File activestorage/app/models/active_storage/variant_with_record.rb, line 20 def process transform_blob { |image| create_or_find_record(image: image) } unless processed? end