Class: Plotline::Entry

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Concerns::Family, Concerns::Searchable, Concerns::Taggable
Defined in:
app/models/plotline/entry.rb

Class Method Summary collapse

Methods included from Concerns::Family

#can_have_parent?, #possible_parents

Methods included from Concerns::Searchable

#search_attributes, #update_search_index

Class Method Details

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



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/models/plotline/entry.rb', line 17

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



31
32
33
# File 'app/models/plotline/entry.rb', line 31

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