Class: ContentBlocks::Snippet

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
AASM
Defined in:
lib/content_blocks/snippet.rb

Constant Summary collapse

LABEL_FORMAT =
/^[a-zA-Z\d_]+$/

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.[](label) ⇒ Object



35
36
37
# File 'lib/content_blocks/snippet.rb', line 35

def self.[](label)
  find_or_create_by_label(label)
end

Instance Method Details

#contentObject



39
40
41
# File 'lib/content_blocks/snippet.rb', line 39

def content
  textilize(raw_content)
end

#raw_contentObject



43
44
45
# File 'lib/content_blocks/snippet.rb', line 43

def raw_content
  self[:content] if published?
end