Class: Ucpengine::Entry

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

Class Method Summary collapse

Methods included from Concerns::Searchable

#search, #searchable_attributes

Class Method Details

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



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/models/ucpengine/entry.rb', line 5

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



19
20
21
# File 'app/models/ucpengine/entry.rb', line 19

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