Module: Instances

Defined in:
backend/app/model/mixins/instances.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'backend/app/model/mixins/instances.rb', line 3

def self.included(base)
  require_relative '../instance'

  base.one_to_many :instance
  Instance.many_to_one base.table_name

  base.def_nested_record(:the_property => :instances,
                         :contains_records_of_type => :instance,
                         :corresponding_to_association => :instance)

  base.extend(ClassMethods)
end

Instance Method Details

#eagerly_load!Object



17
18
19
20
# File 'backend/app/model/mixins/instances.rb', line 17

def eagerly_load!
  Instance.eager_load_relationships(self.instance)
  super
end