Active Storage Variant With Record¶ ↑
类似于 ActiveStorage::Variant,但它将变体(variant)的详细信息作为 ActiveStorage::VariantRecord 存储在数据库中。只有在启用 ActiveStorage.track_variants 时才会使用此功能。
方法
- D
- F
- I
- N
- P
Attributes
| [R] | blob | |
| [R] | 变体 (variation) |
类公共方法
new(blob, variation) 链接
来源: 显示 | 在 GitHub 上
# 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() 链接
销毁记录并从服务中删除文件。
来源: 显示 | 在 GitHub 上
# File activestorage/app/models/active_storage/variant_with_record.rb, line 32 def destroy record&.destroy end
filename() 链接
来源: 显示 | 在 GitHub 上
# 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() 链接
来源: 显示 | 在 GitHub 上
# File activestorage/app/models/active_storage/variant_with_record.rb, line 23 def image record&.image end
processed() 链接
来源: 显示 | 在 GitHub 上
# File activestorage/app/models/active_storage/variant_with_record.rb, line 18 def processed process unless processed? self end