merb_datamapper 1.0.8.1 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/merb_datamapper.rb +25 -25
  2. metadata +3 -3
@@ -5,6 +5,21 @@ if defined?(Merb::Plugins)
5
5
  require File.dirname(__FILE__) / "merb" / "session" / "data_mapper_session"
6
6
  Merb::Plugins.add_rakefiles "merb_datamapper" / "merbtasks"
7
7
 
8
+ # conditionally assign things, so as not to override previously set options.
9
+ # This is most relevent for :use_repository_block, which is used later in this file.
10
+ unless Merb::Plugins.config[:merb_datamapper].has_key?(:use_repository_block)
11
+ Merb::Plugins.config[:merb_datamapper][:use_repository_block] = true
12
+ end
13
+
14
+ unless Merb::Plugins.config[:merb_datamapper].has_key?(:session_storage_name)
15
+ Merb::Plugins.config[:merb_datamapper][:session_storage_name] = 'sessions'
16
+ end
17
+
18
+ unless Merb::Plugins.config[:merb_datamapper].has_key?(:session_repository_name)
19
+ Merb::Plugins.config[:merb_datamapper][:session_repository_name] = :default
20
+ end
21
+
22
+
8
23
  class Merb::Orms::DataMapper::Connect < Merb::BootLoader
9
24
  after BeforeAppLoads
10
25
 
@@ -53,13 +68,15 @@ if defined?(Merb::Plugins)
53
68
  end
54
69
  end
55
70
 
56
- # wrap action in repository block to enable identity map
57
- class Application < Merb::Controller
58
- override! :_call_action
59
- def _call_action(*)
60
- repository do |r|
61
- Merb.logger.debug "In repository block #{r.name}"
62
- super
71
+ if Merb::Plugins.config[:merb_datamapper][:use_repository_block]
72
+ # wrap action in repository block to enable identity map
73
+ class Application < Merb::Controller
74
+ override! :_call_action
75
+ def _call_action(*)
76
+ repository do |r|
77
+ Merb.logger.debug "In repository block #{r.name}"
78
+ super
79
+ end
63
80
  end
64
81
  end
65
82
  end
@@ -68,22 +85,5 @@ if defined?(Merb::Plugins)
68
85
  Merb.add_generators generators / 'data_mapper_model'
69
86
  Merb.add_generators generators / 'data_mapper_resource_controller'
70
87
  Merb.add_generators generators / 'data_mapper_migration'
71
-
72
- # Override bug in DM::Timestamps
73
- Merb::BootLoader.after_app_loads do
74
- module DataMapper
75
- module Timestamp
76
- private
77
-
78
- def set_timestamps
79
- return unless dirty? || new_record?
80
- TIMESTAMP_PROPERTIES.each do |name,(_type,proc)|
81
- if model.properties.has_property?(name)
82
- model.properties[name].set(self, proc.call(self, model.properties[name])) unless attribute_dirty?(name)
83
- end
84
- end
85
- end
86
- end
87
- end
88
- end
88
+
89
89
  end
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: 1.0.8.1
4
+ version: 1.0.9
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: 2009-01-19 00:00:00 -07:00
12
+ date: 2009-02-12 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -40,7 +40,7 @@ dependencies:
40
40
  requirements:
41
41
  - - ~>
42
42
  - !ruby/object:Gem::Version
43
- version: 1.0.8.1
43
+ version: 1.0.9
44
44
  version:
45
45
  description: DataMapper plugin providing DataMapper support for Merb
46
46
  email: jtoy@rubynow.com