Sha256: f6f48f8a463e1195684e1236de0584dafe3d95b4340a920f7e0160a96bad37cf
Contents?: true
Size: 1007 Bytes
Versions: 2
Compression:
Stored size: 1007 Bytes
Contents
module Viewable class Block < ActiveRecord::Base include Viewable include Field::UUID include Admin::Viewable::Block def partial_path @_partial_path ||= "cms/blocks/#{partial_name}" end def partial_name @_partial_name ||= unique_key_name.partition('/').first end class << self def restricted_names @_restricted_names ||= Viewable.names + begin CMS.constants.grep(/Helper$/).map{ |name| "CMS::#{name}".constantize.instance_methods.grep(/^cms_/) }.flatten.map{ |name| name.to_s.sub(/^cms_/, '') } end end def names @_names ||= begin names = CMS.html_names 'app/views/cms/blocks' names.each do |name| if name.in? restricted_names raise ArgumentError, "'cms/blocks/_#{name}.html' partial should be called otherwise, '#{name}' taken" end end names end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rails_admin_cms-0.0.2 | app/models/viewable/block.rb |
rails_admin_cms-0.0.1 | app/models/viewable/block.rb |