Class: EmbeddedImageAsset
- Inherits:
-
EmbeddedAsset
- Object
- ActiveRecord::Base
- ApplicationRecord
- EmbeddedAsset
- EmbeddedImageAsset
- Defined in:
- app/models/embedded_image_asset.rb
Overview
STI subclass for embedded images
Stores image-specific render options (crop, size, format, etc.)
== Schema Information
Table name: embedded_assets
Database name: primary
id :bigint not null, primary key
asset_type :string
options :jsonb not null
parent_type :string not null
type :string
uuid :uuid not null
created_at :datetime not null
updated_at :datetime not null
asset_id :bigint
parent_id :bigint not null
Indexes
idx_embedded_assets_on_asset_and_type (asset_id,asset_type,type)
idx_embedded_assets_parent_asset (parent_type,parent_id,asset_type,asset_id)
index_embedded_assets_on_asset (asset_type,asset_id)
index_embedded_assets_on_type (type)
index_embedded_assets_on_uuid (uuid)
Constant Summary collapse
- PERMITTED_OPTIONS =
Image-specific permitted options for controller
%i[ crop_x crop_y crop_w crop_h crop_mode rotate width height alt caption link link_target encode_format quality blur border border_color background lazyload include_srcset ].freeze
Instance Attribute Summary
Attributes inherited from EmbeddedAsset
Instance Method Summary collapse
-
#render_options ⇒ Object
Returns render options formatted for ImageProvider/oEmbed.
Methods inherited from EmbeddedAsset
#asset, faqs, for_asset_type, for_parent, images, #parent, products, #to_param, videos
Methods inherited from ApplicationRecord
ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation
Methods included from Models::EventPublishable
Instance Method Details
#render_options ⇒ Object
Returns render options formatted for ImageProvider/oEmbed
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'app/models/embedded_image_asset.rb', line 71 def { crop_x: crop_x, crop_y: crop_y, crop_w: crop_w, crop_h: crop_h, crop_mode: crop_mode, rotate: rotate, width: width, height: height, alt: alt, caption: caption, link: link, link_target: link_target, encode_format: encode_format, quality: quality, blur: blur, border: border, border_color: border_color, background: background, lazyload: lazyload, include_srcset: include_srcset }.compact end |