Class: HasSettings::Setting
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- HasSettings::Setting
- Defined in:
- lib/has_settings/setting.rb
Class Method Summary collapse
- .list ⇒ Object
- .protected?(key) ⇒ Boolean
- .setting(key, options = nil) ⇒ Object
- .table_name ⇒ Object
Instance Method Summary collapse
Class Method Details
.list ⇒ Object
21 22 23 |
# File 'lib/has_settings/setting.rb', line 21 def self.list @settings.keys end |
.protected?(key) ⇒ Boolean
29 30 31 |
# File 'lib/has_settings/setting.rb', line 29 def self.protected?(key) @settings[key] end |
.setting(key, options = nil) ⇒ Object
16 17 18 19 |
# File 'lib/has_settings/setting.rb', line 16 def self.setting(key, = nil) @settings ||= {} @settings[key] = && [:protected] end |
.table_name ⇒ Object
25 26 27 |
# File 'lib/has_settings/setting.rb', line 25 def self.table_name name.tableize end |
Instance Method Details
#create ⇒ Object
9 10 11 12 13 14 |
# File 'lib/has_settings/setting.rb', line 9 def create if new_record? super end self end |
#protected? ⇒ Boolean
33 34 35 |
# File 'lib/has_settings/setting.rb', line 33 def protected? self.class.protected?(self.name.to_sym) end |