Sha256: 734d3d89ba6b42968960fc60609d61d9315ce0d72c2b473b99858e8eb1e44c86
Contents?: true
Size: 898 Bytes
Versions: 1
Compression:
Stored size: 898 Bytes
Contents
require 'active_support/concern' require_dependency Smithy::Engine.root.join('app', 'models', 'smithy', 'content_block').to_s module Smithy module ContentBlocks class Registry @@content_blocks = [] class << self def clear @@content_blocks = [] end def content_blocks @@content_blocks end def register(content_block) return unless ActiveRecord::Base.connection.table_exists?(Smithy::ContentBlock.table_name) return unless ActiveRecord::Base.connection.table_exists?(content_block.table_name) content_block_name = content_block.to_s.demodulize @@content_blocks << content_block_name unless @@content_blocks.include?(content_block_name) Smithy::ContentBlock.find_or_create_by(name: content_block_name) @@content_blocks end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
smithycms-0.8.1 | lib/smithy/content_blocks/registry.rb |