Module: Yogo::DataMapper::RepositoryManager::Model
- Defined in:
- lib/yogo/datamapper/repository_manager/model.rb
Instance Method Summary collapse
-
#finalize_managed_models! ⇒ Object
Ensure that Relation models are also managed.
-
#manage(*args) ⇒ Array<DataMapper::Model>
Class method for informing Project instances about what kinds of models might be stored inside thier Project#managed_repository.
-
#managed_models ⇒ Array<DataMapper::Model>
Models that are currently managed by Project instances.
Instance Method Details
#finalize_managed_models! ⇒ Object
Ensure that Relation models are also managed
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/yogo/datamapper/repository_manager/model.rb', line 27 def finalize_managed_models! models = [] @managed_models.each do |m| models += m.relationships.values.map{|r| r.child_model } models += m.relationships.values.map{|r| r.parent_model } end @managed_models += models @managed_models.uniq! @managed_models end |
#manage(*args) ⇒ Array<DataMapper::Model>
Class method for informing Project instances about what kinds of models might be stored inside thier Project#managed_repository.
10 11 12 13 14 15 16 17 18 |
# File 'lib/yogo/datamapper/repository_manager/model.rb', line 10 def manage(*args) @managed_models ||= [] models = args @managed_models += models @managed_models.uniq! @managed_models end |
#managed_models ⇒ Array<DataMapper::Model>
Models that are currently managed by Project instances.
22 23 24 |
# File 'lib/yogo/datamapper/repository_manager/model.rb', line 22 def managed_models @managed_models end |