Class: Yogo::Voeis::Project
- Inherits:
-
Object
- Object
- Yogo::Voeis::Project
- Includes:
- DataMapper::Resource, DataMapper::RepositoryManager
- Defined in:
- lib/yogo/example/voeis/project.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods included from DataMapper::RepositoryManager
Class Method Details
.manage(klass) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/yogo/example/voeis/project.rb', line 18 def self.manage(klass) @managed_models ||= [] unless @managed_models.include?(klass) @managed_models << klass end @managed_models end |
.managed_models ⇒ Object
26 27 28 |
# File 'lib/yogo/example/voeis/project.rb', line 26 def self.managed_models @managed_models end |
Instance Method Details
#adapter_config ⇒ Object
35 36 37 38 39 40 |
# File 'lib/yogo/example/voeis/project.rb', line 35 def adapter_config { :adapter => 'sqlite', :database => "voeis-project-#{managed_repository_name}.db" } end |
#managed_repository_name ⇒ Object
31 32 33 |
# File 'lib/yogo/example/voeis/project.rb', line 31 def managed_repository_name ActiveSupport::Inflector.tableize(id.to_s).to_sym end |
#prepare_models ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/yogo/example/voeis/project.rb', line 42 def prepare_models adapter # ensure the adapter exists or is setup managed_repository.scope { self.class.managed_models.each do |klass| klass.auto_upgrade! end } end |