Class: AppCfg::ModelSource
- Defined in:
- lib/appcfg/sources/model_source.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ ModelSource
constructor
A new instance of ModelSource.
- #reload_data! ⇒ Object
Methods inherited from Source
add, list, reload_sources!, #to_hash
Constructor Details
#initialize(options = {}) ⇒ ModelSource
Returns a new instance of ModelSource.
3 4 5 |
# File 'lib/appcfg/sources/model_source.rb', line 3 def initialize( = {}) @model_class = [:class] end |
Instance Method Details
#reload_data! ⇒ Object
7 8 9 10 11 12 |
# File 'lib/appcfg/sources/model_source.rb', line 7 def reload_data! @hash = {} @model_class.all.each do |instance| @hash[instance.key] = instance.value end end |