Module: Shrine::Plugins::Entity::AttacherClassMethods
- Defined in:
- lib/shrine/plugins/entity.rb
Instance Method Summary collapse
-
#from_entity(record, name, **options) ⇒ Object
Initializes itself from an entity instance and attachment name.
Instance Method Details
#from_entity(record, name, **options) ⇒ Object
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>
78 79 80 81 82 |
# File 'lib/shrine/plugins/entity.rb', line 78 def from_entity(record, name, **) attacher = new(**) attacher.load_entity(record, name) attacher end |