Class: ContentBlocks::Models::Snippet
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- ContentBlocks::Models::Snippet
- Includes:
- AASM
- Defined in:
- lib/content_blocks/models/snippet.rb
Constant Summary collapse
- LABEL_FORMAT =
/^[a-zA-Z\d_]+$/
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.[](label) ⇒ Object
36 37 38 39 |
# File 'lib/content_blocks/models/snippet.rb', line 36 def self.[](label) snippet = published.find_by_label(label) snippet ? snippet : find_or_create_by_label(label) end |
Instance Method Details
#content ⇒ Object
41 42 43 |
# File 'lib/content_blocks/models/snippet.rb', line 41 def content textilize(raw_content) end |
#raw_content ⇒ Object
45 46 47 |
# File 'lib/content_blocks/models/snippet.rb', line 45 def raw_content self[:content] if published? end |