Class: Reference::DataTypes

Inherits:
Object
  • Object
show all
Defined in:
lib/reference/data_types.rb

Overview

Public: This is where you invoke the load command for each reference data type that piggybacks off of the DataList and DataOption models.

Any reference data model with nested reference data structure, is responsible for loading those nested data lists and options.

Relies on the constant ROOT_REFERENCE_MODEL_CLASSES, defined in config/initializers/reference_data_types

Class Method Summary collapse

Class Method Details

.loadObject

Loads all reference data classes with information from DataSets marked active.



11
12
13
14
# File 'lib/reference/data_types.rb', line 11

def self.load
  Rails.logger.info "Reference::DataTypes load(): Loading reference data types."
  Reference::ROOT_REFERENCE_MODEL_CLASSES.each { |reference_class| reference_class.send(:load_reference_data)}
end

.reloadObject

Reloads our reference data. Handy if a data list or data set has changed.



25
26
27
28
29
# File 'lib/reference/data_types.rb', line 25

def self.reload
  Rails.logger.info "Reference::DataTypes reload(): Reloading reference data types."
  self.unload
  self.load
end

.unloadObject

De-registers all cached instances of reference data from each reference data type.



18
19
20
21
# File 'lib/reference/data_types.rb', line 18

def self.unload
  Rails.logger.info "Reference::DataTypes unload(): Unloading reference data types."
  Reference::ROOT_REFERENCE_MODEL_CLASSES.each { |reference_class| reference_class.send(:unload_reference_data)}
end