Module: Keymaker::Node

Defined in:
lib/keymaker/node.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/keymaker/node.rb', line 7

def self.included(base)

  base.class_eval do
    extend ActiveModel::Callbacks
    extend ActiveModel::Naming
    include ActiveModel::MassAssignmentSecurity
    include ActiveModel::Validations
    include ActiveModel::Conversion

    include Keymaker::Indexing
    include Keymaker::Serialization

    extend Keymaker::Node::ClassMethods
    include Keymaker::Node::InstanceMethods

    attr_writer :new_node
    attr_protected :created_at, :updated_at
  end

  base.after_save :update_indices

  base.class_attribute :property_traits
  base.class_attribute :indices_traits

  base.property_traits = {}
  base.indices_traits = {}

  base.property :active_record_id, Integer
  base.property :node_id, Integer
  base.property :created_at, DateTime
  base.property :updated_at, DateTime

end