Class: Offroad::SystemState

Inherits:
ActiveRecord::Base show all
Extended by:
SingleForwardable
Defined in:
lib/app/models/offroad/system_state.rb

Overview

State of the Offroad-managed app as a whole; there should only be one record in this table Attributes of that record can be read via the class methods of this class

Constant Summary

Constants included from ModelExtensions

ModelExtensions::OFFROAD_GROUP_MODES, ModelExtensions::OFFROAD_VALID_MODES

Class Method Summary collapse

Methods included from ModelExtensions

#acts_as_offroadable, #acts_as_offroadable?, #offroad_global_data?, #offroad_group_base?, #offroad_group_data?, #offroad_model_state, #safe_to_load_from_cargo_stream?

Class Method Details

.increment_mirror_versionObject



19
20
21
# File 'lib/app/models/offroad/system_state.rb', line 19

def self.increment_mirror_version
  self.increment_counter(:current_mirror_version, instance_record.id)
end

.instance_recordObject

Returns the singleton record, first creating it if necessary



24
25
26
27
28
29
30
31
# File 'lib/app/models/offroad/system_state.rb', line 24

def self.instance_record
  sys_state = first
  if sys_state
    return sys_state
  else
    return create(:current_mirror_version => 1)
  end
end