Sha256: 3aec48bc31a6137dca1a17b44522505036dd9b238836f1080e5642cea6cba511
Contents?: true
Size: 799 Bytes
Versions: 3
Compression:
Stored size: 799 Bytes
Contents
module PandaCms class BlockContent < ApplicationRecord self.table_name = "panda_cms_block_contents" has_paper_trail versions: { class_name: "PandaCms::BlockContentVersion" } belongs_to :page, foreign_key: :panda_cms_page_id, class_name: "PandaCms::Page", inverse_of: :block_contents, optional: true, touch: true belongs_to :block, foreign_key: :panda_cms_block_id, class_name: "PandaCms::Block", inverse_of: :block_contents, optional: false validates :block, presence: true, uniqueness: {scope: :page} before_save :generate_cache private def generate_cache self.cached_content = if content.is_a?(Hash) && content.dig("source") == "editorJS" EditorJs::Renderer.new(content).render else content end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
panda_cms-0.6.3 | app/models/panda_cms/block_content.rb |
panda_cms-0.6.2 | app/models/panda_cms/block_content.rb |
panda_cms-0.6.1 | app/models/panda_cms/block_content.rb |