Class: BrilliantCms::Entry

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Concerns::Searchable
Defined in:
app/models/brilliant_cms/entry.rb

Direct Known Subclasses

Article, BlogLink, BlogPost

Class Method Summary collapse

Methods included from Concerns::Searchable

#search_attributes, #update_search_index

Class Method Details

.content_attr(attr_name, attr_type = :string) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/models/brilliant_cms/entry.rb', line 7

def self.content_attr(attr_name, attr_type = :string)
  content_attributes[attr_name] = attr_type

  define_method(attr_name) do
    self.payload ||= {}
    self.payload[attr_name.to_s]
  end

  define_method("#{attr_name}=".to_sym) do |value|
    self.payload ||= {}
    self.payload[attr_name.to_s] = value
  end
end

.content_attributesObject



21
22
23
# File 'app/models/brilliant_cms/entry.rb', line 21

def self.content_attributes
  @content_attributes ||= {}
end