Module: Contentable::Model
- Defined in:
- lib/contentable.rb
Overview
Once included in your model (which at least as of now should be named ContentItem) you get class method safe_find_by_title which lets you search for a ContentItem using a specific title and if it can’t find it it presents a default content content_item.
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Class Method Details
.included(model) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/contentable.rb', line 44 def self.included(model) model.extend ClassMethods model.send :attr_accessor, :missing model.validates_uniqueness_of :title ActionView::Base.send :include, Helpers end |