Class: Mir::Models::AppSetting

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/mir/models/app_setting.rb

Class Method Summary collapse

Class Method Details

.backup_pathObject



15
16
17
# File 'lib/mir/models/app_setting.rb', line 15

def self.backup_path
  where(:name => :sync_path).first.value
end

.initialize_table(sync_path) ⇒ Object

Builds entries for the variables that will be used by this application

Parameters:

  • the (String)

    path to be synchronized with S3



9
10
11
12
13
# File 'lib/mir/models/app_setting.rb', line 9

def self.initialize_table(sync_path)
  create(:name => :sync_path, :value => sync_path)
  create(:name => :install_date, :value => DateTime.now)
  create(:name => :last_indexed_at, :value => nil)
end

.last_indexed_atObject



24
25
26
# File 'lib/mir/models/app_setting.rb', line 24

def self.last_indexed_at
  where(:name => :last_indexed_at).first.value
end

.last_indexed_at=(val) ⇒ Object



19
20
21
22
# File 'lib/mir/models/app_setting.rb', line 19

def self.last_indexed_at=(val)
  record = where(:name => :last_indexed_at).first
  record.update_attribute(:value, val)
end