Module Waves::Layers::ORM::DataMapper
In: lib/layers/orm/providers/data_mapper.rb

Work in Progress

Methods

included  

Public Class methods

[Source]

    # File lib/layers/orm/providers/data_mapper.rb, line 8
 8:         def self.included(app)
 9:           gem 'dm-core', '=0.9.0'
10: 
11:           require 'data_mapper'
12:           
13:           def app.database
14:             @adapter ||= ::DataMapper.setup(:main_repository, config.database[:database])
15:           end
16:           
17:           app.auto_eval :Models do
18:             auto_load true, :directories => [:models]
19:           end
20: 
21:           app.auto_eval :Configurations do
22:             auto_eval :Mapping do
23:               before true do
24:                 app.database #force adapter init if not already done
25:                 ::DataMapper::Repository.context.push(::DataMapper::Repository.new(:main_repository))
26:               end
27:               always true do
28:                 ::DataMapper::Repository.context.pop
29:               end
30:             end
31:           end
32:             
33:         end

[Validate]