Module: Cms::Content
- Defined in:
- app/models/cms/content.rb
Overview
An API for interacting with the Content API of BrowserCMS.
Class Method Summary collapse
-
.find(content_type, id) ⇒ ContentBlock
Find a single content item.
-
.find_draft(content_type, id) ⇒ ContentBlock
Find the latest draft for a single content item.
Class Method Details
.find(content_type, id) ⇒ ContentBlock
12 13 14 15 16 17 18 |
# File 'app/models/cms/content.rb', line 12 def self.find(content_type, id) if content_type == "page" return Cms::Page.find(id) end type = ContentType.find_by_key(content_type) type.model_class.find(id) end |
.find_draft(content_type, id) ⇒ ContentBlock
27 28 29 |
# File 'app/models/cms/content.rb', line 27 def self.find_draft(content_type, id) find(content_type, id).as_of_draft_version end |