merb_datamapper 0.9.7 → 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,7 +17,6 @@ lib/generators/templates/views/new.html.erb
17
17
  lib/generators/templates/views/show.html.erb
18
18
  lib/merb/orms/data_mapper/connection.rb
19
19
  lib/merb/orms/data_mapper/database.yml.sample
20
- lib/merb/orms/data_mapper/resource.rb
21
20
  lib/merb/session/data_mapper_session.rb
22
21
  lib/merb_datamapper.rb
23
22
  lib/merb_datamapper/merbtasks.rb
data/Rakefile CHANGED
@@ -45,7 +45,7 @@ end
45
45
  desc 'Run specifications'
46
46
  Spec::Rake::SpecTask.new(:spec) do |t|
47
47
  t.spec_opts << '--options' << 'spec/spec.opts' if File.exists?('spec/spec.opts')
48
- t.spec_files = Pathname.glob(Pathname.new(__FILE__).dirname + 'spec/**/*_spec.rb')
48
+ t.spec_files = Pathname.glob((ROOT + 'spec/**/*_spec.rb').to_s)
49
49
 
50
50
  begin
51
51
  t.rcov = ENV.has_key?('NO_RCOV') ? ENV['NO_RCOV'] != 'true' : true
@@ -34,3 +34,6 @@ production:
34
34
  # repositories:
35
35
  # repo1:
36
36
  # database: sample_development
37
+
38
+ rake:
39
+ <<: *defaults
@@ -1,10 +1,3 @@
1
- begin
2
- gem 'dm-core', '=0.9.6'
3
- require 'dm-core'
4
- rescue LoadError => e
5
- require 'data_mapper'
6
- end
7
-
8
1
  require 'merb-core/dispatch/session'
9
2
 
10
3
  module Merb
@@ -26,13 +26,31 @@ if defined?(Merb::Plugins)
26
26
  require File.dirname(__FILE__) / "merb" / "session" / "data_mapper_session"
27
27
  end
28
28
 
29
- # required to provide 'to_param'
30
- require File.dirname(__FILE__) / "merb" / "orms" / "data_mapper" / "resource"
29
+ # take advantage of the fact #id returns the key of the model, unless #id is a property
30
+ Merb::Router.root_behavior = Merb::Router.root_behavior.identify(DataMapper::Resource => :id)
31
31
 
32
32
  Merb.logger.debug "Merb::Orms::DataMapper::Connect complete"
33
33
  end
34
34
  end
35
35
 
36
+ class Merb::Orms::DataMapper::Associations < Merb::BootLoader
37
+ after LoadClasses
38
+
39
+ def self.run
40
+ Merb.logger.debug 'Merb::Orms::DataMapper::Associations block.'
41
+
42
+ # make sure all relationships are initialized after loading
43
+ descendants = DataMapper::Resource.descendants.dup
44
+ descendants.each do |model|
45
+ descendants.merge(model.descendants) if model.respond_to?(:descendants)
46
+ end
47
+ descendants.each do |model|
48
+ model.relationships.each_value { |r| r.child_key }
49
+ end
50
+
51
+ Merb.logger.debug 'Merb::Orms::DataMapper::Associations complete'
52
+ end
53
+ end
36
54
 
37
55
  generators = File.join(File.dirname(__FILE__), 'generators')
38
56
  Merb.add_generators generators / 'data_mapper_model'
@@ -1,5 +1,5 @@
1
1
  module DataMapper
2
2
  module MerbDataMapper
3
- VERSION = "0.9.7"
3
+ VERSION = "0.9.8"
4
4
  end
5
5
  end
@@ -6,4 +6,3 @@ require 'rubygems'
6
6
  gem 'dm-core', '=0.9.6'
7
7
  require 'dm-core'
8
8
  require 'merb-core'
9
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merb_datamapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.7
4
+ version: 0.9.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Toy
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-14 00:00:00 +03:00
12
+ date: 2008-10-07 00:00:00 +03:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -93,7 +93,6 @@ files:
93
93
  - lib/generators/templates/views/show.html.erb
94
94
  - lib/merb/orms/data_mapper/connection.rb
95
95
  - lib/merb/orms/data_mapper/database.yml.sample
96
- - lib/merb/orms/data_mapper/resource.rb
97
96
  - lib/merb/session/data_mapper_session.rb
98
97
  - lib/merb_datamapper.rb
99
98
  - lib/merb_datamapper/merbtasks.rb
@@ -1,12 +0,0 @@
1
- module Merb
2
- module Orms
3
- module DataMapper
4
- module Resource
5
- def to_param
6
- key
7
- end
8
- end
9
- end
10
- end
11
- end
12
- DataMapper::Resource.send(:include, Merb::Orms::DataMapper::Resource)