Spec-Zone.ru › Ruby on Rails 7.2

класс ActiveStorage::VariantWithRecord

Родитель:
Объект

Вариант Active Storage с записью

Подобно ActiveStorage::Variant, но сохраняет подробности о варианте в базе данных как ActiveStorage::VariantRecord. Используется только если ActiveStorage.track_variants включено.

Атрибуты

blob[R]
variation[R]

Публичные методы класса

new(blob, variation) Показать исходный код
# File activestorage/app/models/active_storage/variant_with_record.rb, line 14
def initialize(blob, variation)
  @blob, @variation = blob, ActiveStorage::Variation.wrap(variation)
end

Публичные методы экземпляра

destroy() Показать исходный код
# File activestorage/app/models/active_storage/variant_with_record.rb, line 32
def destroy
  record&.destroy
end

Удаляет запись и файл из сервиса.

filename() Показать исходный код
# File activestorage/app/models/active_storage/variant_with_record.rb, line 27
def filename
  ActiveStorage::Filename.new "#{blob.filename.base}.#{variation.format.downcase}"
end
image() Показать исходный код
# File activestorage/app/models/active_storage/variant_with_record.rb, line 23
def image
  record&.image
end
processed() Показать исходный код
# File activestorage/app/models/active_storage/variant_with_record.rb, line 18
def processed
  process unless processed?
  self
end

© 2004–2021 David Heinemeier Hansson
Licensed under the MIT License.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API