Class: Thecore::Seed

Inherits:
Object
  • Object
show all
Defined in:
lib/thecore/seed.rb

Class Method Summary collapse

Class Method Details

.delete_setting(ns, setting) ⇒ Object



12
13
14
15
# File 'lib/thecore/seed.rb', line 12

def self.delete_setting ns, setting
  puts "Removing setting #{ns}: #{setting}"
  ThecoreSettings::Setting.where(ns: ns, key: setting).destroy_all
end

.save_setting(ns, setting, value) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/thecore/seed.rb', line 4

def self.save_setting ns, setting, value
  puts "Saving setting if nil #{ns}: #{setting} = #{value}"
  if ::Settings.ns(ns)[setting].blank?
    ::Settings.ns(ns)[setting] if value.blank?
    ::Settings.ns(ns)[setting] = value unless value.blank?
  end
end