Class: SnowmanIO::Setting

Inherits:
Object
  • Object
show all
Includes:
Mongoid::Document
Defined in:
lib/snowman-io/models/setting.rb

Class Method Summary collapse

Class Method Details

.force_ssl?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/snowman-io/models/setting.rb', line 16

def self.force_ssl?
  !!Setting.get(SnowmanIO::FORCE_SSL_KEY)
end

.get(key) ⇒ Object



12
13
14
# File 'lib/snowman-io/models/setting.rb', line 12

def self.get(key)
  Setting.where(name: key).first.try(:value)
end

.set(key, value) ⇒ Object



8
9
10
# File 'lib/snowman-io/models/setting.rb', line 8

def self.set(key, value)
  Setting.find_or_create_by!(name: key).update_attributes!(value: value)
end

.set_force_ssl(value) ⇒ Object



20
21
22
# File 'lib/snowman-io/models/setting.rb', line 20

def self.set_force_ssl(value)
  Setting.set(SnowmanIO::FORCE_SSL_KEY, value)
end