mack-data_mapper 0.7.0.1 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/doc/classes/Mack.html +8 -0
  2. data/doc/classes/Mack/{Testing/Helpers.html → DataMapper/Session.html} +24 -18
  3. data/doc/classes/Mack/Database.html +35 -35
  4. data/doc/classes/Mack/Database/Generators.html +6 -6
  5. data/doc/classes/Mack/Database/Migrations.html +24 -24
  6. data/doc/classes/Mack/SessionStore/DataMapper.html +262 -0
  7. data/doc/classes/Mack/Testing/DataMapperHelpers.html +21 -21
  8. data/doc/classes/Mack/ViewHelpers/DataMapperHelpers.html +1 -1
  9. data/doc/created.rid +1 -1
  10. data/doc/files/README.html +1 -1
  11. data/doc/files/lib/mack-data_mapper/database_migrations_rb.html +1 -1
  12. data/doc/files/lib/mack-data_mapper/database_rb.html +1 -1
  13. data/doc/files/lib/mack-data_mapper/dm_patches/dm-timestamps_rb.html +16 -1
  14. data/doc/files/lib/mack-data_mapper/dm_patches/migrations_rb.html +1 -1
  15. data/doc/files/lib/mack-data_mapper/dm_patches/model_rb.html +58 -1
  16. data/doc/files/lib/mack-data_mapper/dm_patches/property_set_rb.html +25 -1
  17. data/doc/files/lib/mack-data_mapper/dm_patches/validations_rb.html +25 -1
  18. data/doc/files/lib/mack-data_mapper/generators_rb.html +1 -1
  19. data/doc/files/lib/mack-data_mapper/helpers/orm_helpers_rb.html +1 -1
  20. data/doc/files/lib/mack-data_mapper/migration_generator/migration_generator_rb.html +1 -1
  21. data/doc/files/lib/mack-data_mapper/model_generator/model_generator_rb.html +1 -1
  22. data/doc/files/lib/mack-data_mapper/resource_rb.html +1 -1
  23. data/doc/files/lib/mack-data_mapper/runner_rb.html +1 -1
  24. data/doc/files/lib/mack-data_mapper/sessions/data_mapper_session_store_rb.html +101 -0
  25. data/doc/files/lib/mack-data_mapper/sessions/session_rb.html +101 -0
  26. data/doc/files/lib/mack-data_mapper/test_extensions_rb.html +1 -1
  27. data/doc/files/lib/mack-data_mapper_rb.html +1 -1
  28. data/doc/files/lib/mack-data_mapper_tasks_rb.html +1 -1
  29. data/doc/fr_class_index.html +2 -1
  30. data/doc/fr_file_index.html +2 -0
  31. data/doc/fr_method_index.html +14 -10
  32. data/lib/mack-data_mapper.rb +11 -7
  33. data/lib/mack-data_mapper/database.rb +8 -8
  34. data/lib/mack-data_mapper/database_migrations.rb +6 -6
  35. data/lib/mack-data_mapper/dm_patches/dm-timestamps.rb +6 -6
  36. data/lib/mack-data_mapper/dm_patches/model.rb +48 -48
  37. data/lib/mack-data_mapper/dm_patches/property_set.rb +15 -15
  38. data/lib/mack-data_mapper/dm_patches/validations.rb +15 -15
  39. data/lib/mack-data_mapper/helpers/orm_helpers.rb +1 -1
  40. data/lib/mack-data_mapper/sessions/data_mapper_session_store.rb +62 -0
  41. data/lib/mack-data_mapper/sessions/session.rb +14 -0
  42. data/lib/mack-data_mapper/test_extensions.rb +0 -9
  43. metadata +17 -22
@@ -80,7 +80,7 @@
80
80
  <h3 class="section-bar">Methods</h3>
81
81
 
82
82
  <div class="name-list">
83
- <a href="#M000012">rollback_transaction</a>&nbsp;&nbsp;
83
+ <a href="#M000016">rollback_transaction</a>&nbsp;&nbsp;
84
84
  </div>
85
85
  </div>
86
86
 
@@ -102,35 +102,35 @@
102
102
  <div id="methods">
103
103
  <h3 class="section-bar">Public Instance methods</h3>
104
104
 
105
- <div id="method-M000012" class="method-detail">
106
- <a name="M000012"></a>
105
+ <div id="method-M000016" class="method-detail">
106
+ <a name="M000016"></a>
107
107
 
108
108
  <div class="method-heading">
109
- <a href="#M000012" class="method-signature">
109
+ <a href="#M000016" class="method-signature">
110
110
  <span class="method-name">rollback_transaction</span><span class="method-args">() {|if block_given?| ...}</span>
111
111
  </a>
112
112
  </div>
113
113
 
114
114
  <div class="method-description">
115
115
  <p><a class="source-toggle" href="#"
116
- onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
117
- <div class="method-source-code" id="M000012-source">
116
+ onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
117
+ <div class="method-source-code" id="M000016-source">
118
118
  <pre>
119
- <span class="ruby-comment cmt"># File lib/mack-data_mapper/test_extensions.rb, line 30</span>
120
- 30: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rollback_transaction</span>
121
- 31: <span class="ruby-keyword kw">begin</span>
122
- 32: <span class="ruby-constant">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">Testing</span><span class="ruby-operator">::</span><span class="ruby-constant">DmTestTransactionWrapper</span>.<span class="ruby-identifier">transaction</span> <span class="ruby-keyword kw">do</span>
123
- 33: <span class="ruby-comment cmt"># DataMapper::Transaction.new.commit do</span>
124
- 34: <span class="ruby-keyword kw">yield</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
125
- 35: <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Rollback!&quot;</span>
126
- 36: <span class="ruby-keyword kw">end</span>
127
- 37: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ex</span>
128
- 38: <span class="ruby-comment cmt"># we need to do this so we can throw up actual errors!</span>
129
- 39: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">ex</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;Rollback!&quot;</span>
130
- 40: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">ex</span>
131
- 41: <span class="ruby-keyword kw">end</span>
132
- 42: <span class="ruby-keyword kw">end</span>
133
- 43: <span class="ruby-keyword kw">end</span>
119
+ <span class="ruby-comment cmt"># File lib/mack-data_mapper/test_extensions.rb, line 21</span>
120
+ 21: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rollback_transaction</span>
121
+ 22: <span class="ruby-keyword kw">begin</span>
122
+ 23: <span class="ruby-constant">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">Testing</span><span class="ruby-operator">::</span><span class="ruby-constant">DmTestTransactionWrapper</span>.<span class="ruby-identifier">transaction</span> <span class="ruby-keyword kw">do</span>
123
+ 24: <span class="ruby-comment cmt"># DataMapper::Transaction.new.commit do</span>
124
+ 25: <span class="ruby-keyword kw">yield</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
125
+ 26: <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Rollback!&quot;</span>
126
+ 27: <span class="ruby-keyword kw">end</span>
127
+ 28: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">ex</span>
128
+ 29: <span class="ruby-comment cmt"># we need to do this so we can throw up actual errors!</span>
129
+ 30: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">ex</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;Rollback!&quot;</span>
130
+ 31: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">ex</span>
131
+ 32: <span class="ruby-keyword kw">end</span>
132
+ 33: <span class="ruby-keyword kw">end</span>
133
+ 34: <span class="ruby-keyword kw">end</span>
134
134
  </pre>
135
135
  </div>
136
136
  </div>
@@ -155,7 +155,7 @@ path to partial as the second argument and that partial will be rendered.
155
155
  36: <span class="ruby-identifier">app_errors</span>.<span class="ruby-identifier">flatten!</span>
156
156
  37: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">app_errors</span>.<span class="ruby-identifier">empty?</span>
157
157
  38: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">view_partial</span>.<span class="ruby-identifier">nil?</span>
158
- 39: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">Mack</span>.<span class="ruby-identifier">root</span>, <span class="ruby-value str">&quot;app&quot;</span>, <span class="ruby-value str">&quot;views&quot;</span>, <span class="ruby-value str">&quot;application&quot;</span>, <span class="ruby-value str">&quot;_error_messages.html.erb&quot;</span>))
158
+ 39: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-constant">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">Paths</span>.<span class="ruby-identifier">views</span>(<span class="ruby-value str">&quot;application&quot;</span>, <span class="ruby-value str">&quot;_error_messages.html.erb&quot;</span>))
159
159
  40: <span class="ruby-identifier">render</span>(<span class="ruby-identifier">:partial</span>, <span class="ruby-value str">&quot;application/error_messages&quot;</span>, <span class="ruby-identifier">:locals</span> =<span class="ruby-operator">&gt;</span> {<span class="ruby-identifier">:errors</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">app_errors</span>})
160
160
  41: <span class="ruby-keyword kw">else</span>
161
161
  42: <span class="ruby-identifier">render</span>(<span class="ruby-identifier">:inline</span>, <span class="ruby-constant">DEFAULT_PARTIAL</span>, <span class="ruby-identifier">:locals</span> =<span class="ruby-operator">&gt;</span> {<span class="ruby-identifier">:errors</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">app_errors</span>})
data/doc/created.rid CHANGED
@@ -1 +1 @@
1
- Fri, 29 Aug 2008 11:37:03 -0400
1
+ Mon, 08 Sep 2008 10:56:53 -0400
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Mon Aug 25 10:11:28 -0400 2008</td>
59
+ <td>Mon Sep 08 10:32:44 -0400 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Fri Aug 29 11:33:21 -0400 2008</td>
59
+ <td>Mon Sep 08 10:32:44 -0400 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Fri Aug 29 11:33:21 -0400 2008</td>
59
+ <td>Mon Sep 08 10:32:44 -0400 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Fri Aug 29 11:33:21 -0400 2008</td>
59
+ <td>Mon Sep 08 10:32:44 -0400 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -68,6 +68,21 @@
68
68
 
69
69
  <div id="contextContent">
70
70
 
71
+ <div id="description">
72
+ <p>
73
+ module DataMapper # :nodoc:
74
+ </p>
75
+ <pre>
76
+ module Timestamp # :nodoc:
77
+ TIMESTAMP_PROPERTIES[:created_at] = lambda { |r| r.created_at = DateTime.now if r.new_record? &amp;&amp; r.created_at.nil? } # :nodoc:
78
+ TIMESTAMP_PROPERTIES[:created_on] = lambda { |r| r.created_on = DateTime.now if r.new_record? &amp;&amp; r.created_on.nil? } # :nodoc:
79
+ end
80
+ </pre>
81
+ <p>
82
+ end
83
+ </p>
84
+
85
+ </div>
71
86
 
72
87
 
73
88
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Fri Aug 29 11:33:21 -0400 2008</td>
59
+ <td>Mon Sep 08 10:32:44 -0400 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Fri Aug 29 11:33:21 -0400 2008</td>
59
+ <td>Mon Sep 08 10:32:44 -0400 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -68,6 +68,63 @@
68
68
 
69
69
  <div id="contextContent">
70
70
 
71
+ <div id="description">
72
+ <p>
73
+ module DataMapper # :nodoc:
74
+ </p>
75
+ <pre>
76
+ module Model # :nodoc:
77
+
78
+ def property(name, type, options = {})
79
+ property = Property.new(self, name, type, options)
80
+
81
+ create_property_getter(property)
82
+ create_property_setter(property)
83
+
84
+ @properties[repository_name][property.name] = property
85
+
86
+ # Add property to the other mappings as well if this is for the default
87
+ # repository.
88
+ if repository_name == default_repository_name
89
+ @properties.each_pair do |repository_name, properties|
90
+ next if repository_name == default_repository_name
91
+ properties &lt;&lt; property
92
+ end
93
+ end
94
+
95
+ # Add the property to the lazy_loads set for this resources repository
96
+ # only.
97
+ # TODO Is this right or should we add the lazy contexts to all
98
+ # repositories?
99
+ if property.lazy?
100
+ context = options.fetch(:lazy, :default)
101
+ context = :default if context == true
102
+
103
+ Array(context).each do |item|
104
+ @properties[repository_name].lazy_context(item) &lt;&lt; name
105
+ end
106
+ end
107
+
108
+ # add the property to the child classes only if the property was
109
+ # added after the child classes' properties have been copied from
110
+ # the parent
111
+ if respond_to?(:descendants)
112
+ descendants.each do |model|
113
+ next if model.properties(repository_name).has_property?(name)
114
+ model.property(name, type, options)
115
+ end
116
+ end
117
+
118
+ property
119
+ end
120
+
121
+ end # module Model
122
+ </pre>
123
+ <p>
124
+ end # module DataMapper
125
+ </p>
126
+
127
+ </div>
71
128
 
72
129
 
73
130
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Fri Aug 29 11:33:21 -0400 2008</td>
59
+ <td>Mon Sep 08 10:32:44 -0400 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -68,6 +68,30 @@
68
68
 
69
69
  <div id="contextContent">
70
70
 
71
+ <div id="description">
72
+ <p>
73
+ module DataMapper # :nodoc:
74
+ </p>
75
+ <pre>
76
+ class PropertySet # :nodoc:
77
+
78
+ def []=(name, property)
79
+ if existing_property = detect { |p| p.name == name }
80
+ property.hash
81
+ @entries[@entries.index(existing_property)] = property
82
+ else
83
+ add(property)
84
+ end
85
+ property
86
+ end
87
+
88
+ end # class PropertySet
89
+ </pre>
90
+ <p>
91
+ end # module DataMapper
92
+ </p>
93
+
94
+ </div>
71
95
 
72
96
 
73
97
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Fri Aug 29 11:33:21 -0400 2008</td>
59
+ <td>Mon Sep 08 10:32:44 -0400 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -68,6 +68,30 @@
68
68
 
69
69
  <div id="contextContent">
70
70
 
71
+ <div id="description">
72
+ <p>
73
+ module DataMapper # :nodoc:
74
+ </p>
75
+ <pre>
76
+ module Validate # :nodoc:
77
+ class GenericValidator # :nodoc:
78
+
79
+ def ==(other)
80
+ self.field_name == other.field_name &amp;&amp;
81
+ self.if_clause == other.if_clause &amp;&amp;
82
+ self.class == other.class &amp;&amp;
83
+ self.unless_clause == other.unless_clause &amp;&amp;
84
+ self.instance_variable_get(:@options) == other.instance_variable_get(:@options)
85
+ end
86
+
87
+ end # class GenericValidator
88
+ end # module Validate
89
+ </pre>
90
+ <p>
91
+ end # module DataMapper
92
+ </p>
93
+
94
+ </div>
71
95
 
72
96
 
73
97
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Fri Aug 29 11:33:21 -0400 2008</td>
59
+ <td>Mon Sep 08 10:32:44 -0400 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Fri Aug 29 11:33:21 -0400 2008</td>
59
+ <td>Mon Sep 08 10:32:44 -0400 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Fri Aug 29 11:33:21 -0400 2008</td>
59
+ <td>Mon Sep 08 10:32:44 -0400 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Fri Aug 29 11:33:21 -0400 2008</td>
59
+ <td>Mon Sep 08 10:32:44 -0400 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Mon Aug 25 10:11:28 -0400 2008</td>
59
+ <td>Mon Sep 08 10:32:44 -0400 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Mon Aug 25 10:11:28 -0400 2008</td>
59
+ <td>Mon Sep 08 10:32:44 -0400 2008</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -0,0 +1,101 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>File: data_mapper_session_store.rb</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="fileHeader">
50
+ <h1>data_mapper_session_store.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>lib/mack-data_mapper/sessions/data_mapper_session_store.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Mon Sep 08 10:32:44 -0400 2008</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+
72
+
73
+ </div>
74
+
75
+
76
+ </div>
77
+
78
+
79
+ <!-- if includes -->
80
+
81
+ <div id="section">
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+ <!-- if method_list -->
91
+
92
+
93
+ </div>
94
+
95
+
96
+ <div id="validator-badges">
97
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
98
+ </div>
99
+
100
+ </body>
101
+ </html>