Class: Simplec::EmbeddedImage
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Simplec::EmbeddedImage
- Defined in:
- app/models/simplec/embedded_image.rb
Overview
An embedded image in an editor field.
For the most part you don’t need to utilize this record. These records are created by summernote and the administration of creating them is handled by the Simplec Engine.
There is an #embedded_images association on a Simplec::Page record.
Instance Attribute Summary collapse
-
#asset ⇒ Dragonfly::Model::Attachment?
The embedded asset.
-
#asset_name ⇒ String?
The name of the Dragonfly #asset.
-
#asset_uid ⇒ String?
The unique id of the Dragonfly #asset.
-
#embeddable ⇒ Object?
The object that owns the embedded image.
-
#embeddable_id ⇒ String, ...
The uuid (or id) of the #embeddable association.
-
#embeddable_type ⇒ String?
The type of the #embeddable association.
Instance Method Summary collapse
-
#url ⇒ String
(also: #asset_url)
Dragonfly url for the asset.
Instance Attribute Details
#asset ⇒ Dragonfly::Model::Attachment?
Returns The embedded asset.
23 |
# File 'app/models/simplec/embedded_image.rb', line 23 dragonfly_accessor :asset |
#asset_name ⇒ String?
Returns The name of the Dragonfly #asset.
|
|
# File 'app/models/simplec/embedded_image.rb', line 34
|
#asset_uid ⇒ String?
Returns The unique id of the Dragonfly #asset.
|
|
# File 'app/models/simplec/embedded_image.rb', line 31
|
#embeddable ⇒ Object?
The object that owns the embedded image
17 18 19 |
# File 'app/models/simplec/embedded_image.rb', line 17 belongs_to :embeddable, polymorphic: true, optional: true |
#embeddable_id ⇒ String, ...
Returns The uuid (or id) of the #embeddable association.
|
|
# File 'app/models/simplec/embedded_image.rb', line 28
|
#embeddable_type ⇒ String?
Returns The type of the #embeddable association.
|
|
# File 'app/models/simplec/embedded_image.rb', line 25
|
Instance Method Details
#url ⇒ String Also known as: asset_url
Dragonfly url for the asset.
40 41 42 43 44 |
# File 'app/models/simplec/embedded_image.rb', line 40 def url return unless self.asset return self.asset.url unless persisted? self.asset.url(ei: Base64.urlsafe_encode64(self.id.to_s)) end |