Class: Setting
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Setting
show all
- Includes:
- ConfigManager
- Defined in:
- app/models/setting.rb
Overview
require ‘lib/config_manager’ Setting is the setting of one webapplication Maybe in futur, there are several webapp. I don’t know the settings is save in a hash serializable in Database
Class Method Summary
collapse
Instance Method Summary
collapse
append_features, #canonicalize
Constructor Details
Returns a new instance of Setting.
25
26
27
28
|
# File 'app/models/setting.rb', line 25
def initialize
super
self.settings = {}
end
|
Class Method Details
.default ⇒ Object
Return the fist webapp by Id. But if there are no Setting save in first A setting is create
33
34
35
36
37
38
39
40
|
# File 'app/models/setting.rb', line 33
def self.default
s = Setting.find :first, :order => 'id'
if s.nil?
Setting.new
else
s
end
end
|
Instance Method Details
#change_size_thumbnails? ⇒ Boolean
42
43
44
|
# File 'app/models/setting.rb', line 42
def change_size_thumbnails?
setting_changed?('thumbnail_max_width') || setting_changed?('thumbnail_max_height')
end
|
#change_size_view? ⇒ Boolean
46
47
48
|
# File 'app/models/setting.rb', line 46
def change_size_view?
setting_changed?('picture_max_width') || setting_changed?('picture_max_height')
end
|
#empty_setting_changed ⇒ Object
54
55
56
|
# File 'app/models/setting.rb', line 54
def empty_setting_changed
@settings_changed = []
end
|
#setting_changed?(field) ⇒ Boolean
58
59
60
|
# File 'app/models/setting.rb', line 58
def setting_changed?(field)
settings_changed.include? field
end
|
#settings_changed ⇒ Object
50
51
52
|
# File 'app/models/setting.rb', line 50
def settings_changed
@settings_changed ||= []
end
|