Class: Lanes::SystemSettings
- Inherits:
-
Model
- Object
- ActiveRecord::Base
- Model
- Lanes::SystemSettings
show all
- Defined in:
- lib/lanes/system_settings.rb
Defined Under Namespace
Classes: ExtensionSettings
Class Method Summary
collapse
Instance Method Summary
collapse
#_set_attribute_data_from_collection, #set_attribute_data, #setting_attribute_is_allowed?
Class Method Details
.clear_cache!(msg) ⇒ Object
59
60
61
62
|
# File 'lib/lanes/system_settings.rb', line 59
def clear_cache!(msg)
Lanes.logger.debug "SystemSettings cache reset"
Lanes::SystemSettings.instance_variable_set(:@config, nil)
end
|
.config ⇒ Object
33
34
35
|
# File 'lib/lanes/system_settings.rb', line 33
def config
@config ||= SystemSettings.find_or_create_by(id: Lanes.config.configuration_id)
end
|
.for_ext(extension_id) ⇒ Object
37
38
39
|
# File 'lib/lanes/system_settings.rb', line 37
def for_ext(extension_id)
ExtensionSettings.new(extension_id, config.settings[extension_id])
end
|
.persist!(extension_id, update) ⇒ Object
41
42
43
44
45
|
# File 'lib/lanes/system_settings.rb', line 41
def persist!(extension_id, update)
config.settings[extension_id] = update
config.settings_will_change!
config.save!
end
|
.update_handler ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/lanes/system_settings.rb', line 47
def update_handler
lambda do
wrap_reply do
config = SystemSettings.config
if data['settings'].is_a?(Hash)
config.update_attributes!(settings: data['settings'])
end
std_api_reply :update, { settings: config.settings }, success: true
end
end
end
|
Instance Method Details
#notify_updated ⇒ Object
28
29
30
|
# File 'lib/lanes/system_settings.rb', line 28
def notify_updated
Lanes.redis_connection.publish('lanes-system-configuration-update', self.id)
end
|