Module: Abstractor::Methods::Models::AbstractorAbstraction

Included in:
AbstractorAbstraction
Defined in:
lib/abstractor/methods/models/abstractor_abstraction.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
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
# File 'lib/abstractor/methods/models/abstractor_abstraction.rb', line 5

def self.included(base)
  base.send :include, SoftDelete
  base.send :has_paper_trail

  # Associations
  base.send :belongs_to, :abstractor_subject

  base.send :has_many, :abstractor_suggestions
  base.send :has_many, :abstractor_abstraction_sources, :through => :abstractor_abstractor_suggestions
  base.send :has_many, :abstractor_indirect_sources

  base.send :has_one, :abstractor_abstraction_group_member
  base.send :has_one, :abstractor_abstraction_group, :through => :abstractor_abstraction_group_member
  base.send :has_one, :abstractor_abstraction_schema, :through => :abstractor_subject

  base.send :accepts_nested_attributes_for, :abstractor_suggestions
  base.send :accepts_nested_attributes_for, :abstractor_indirect_sources

  base.send :belongs_to, :about, polymorphic: true

  base.send :validates_associated, :abstractor_subject

  # base.send :attr_accessible, :about, :abstractor_subject, :abstractor_subject_id, :value, :about_type, :about_id, :unknown, :not_applicable, :deleted_at, :abstractor_indirect_sources_attributes

  # Hooks
  base.send :after_save, :review_matching_suggestions

  base.send(:include, InstanceMethods)
  base.extend(ClassMethods)
end