module Shrine::Plugins::Entity::AttacherClassMethods
Public Instance Methods
from_entity(record, name, **options)
click to toggle source
Initializes itself from an entity instance and attachment name.
photo.image_data #=> "{...}" # a file is attached attacher = Attacher.from_entity(photo, :image) attacher.file #=> #<Shrine::UploadedFile>
# File lib/shrine/plugins/entity.rb, line 84 def from_entity(record, name, **options) attacher = new(**options) attacher.load_entity(record, name) attacher end