Class: Content
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Content
- Defined in:
- app/models/content.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_slug(slug, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'app/models/content.rb', line 11 def from_slug(slug, ={}) raise NoDefaultContentError if [:default].nil? find_or_initialize_by_slug(slug).tap do |content| if content.new_record? content.name = slug content.text = [:default] content.save end end end |
Instance Method Details
#parsed_text ⇒ Object
7 8 9 |
# File 'app/models/content.rb', line 7 def parsed_text RDiscount.new(text).to_html.html_safe end |