mack-data_mapper 0.6.0.1 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +115 -4
- data/lib/mack-data_mapper.rb +14 -12
- data/lib/{database.rb → mack-data_mapper/database.rb} +0 -0
- data/lib/mack-data_mapper/dm_patches/dm-timestamps.rb +6 -0
- data/lib/mack-data_mapper/dm_patches/migrations.rb +9 -0
- data/lib/{genosaurus_helpers.rb → mack-data_mapper/genosaurus_helpers.rb} +1 -1
- data/lib/{helpers → mack-data_mapper/helpers}/orm_helpers.rb +4 -2
- data/lib/{migration_generator → mack-data_mapper/migration_generator}/migration_generator.rb +0 -0
- data/lib/{migration_generator → mack-data_mapper/migration_generator}/templates/db/migrations/%=@migration_name%.rb.template +0 -0
- data/lib/{model_column.rb → mack-data_mapper/model_column.rb} +3 -3
- data/lib/{model_generator → mack-data_mapper/model_generator}/manifest.yml +0 -0
- data/lib/{model_generator → mack-data_mapper/model_generator}/model_generator.rb +0 -0
- data/lib/{model_generator → mack-data_mapper/model_generator}/templates/model.rb.template +0 -0
- data/lib/{model_generator → mack-data_mapper/model_generator}/templates/rspec.rb.template +0 -0
- data/lib/{model_generator → mack-data_mapper/model_generator}/templates/test_case.rb.template +0 -0
- data/lib/{resource.rb → mack-data_mapper/resource.rb} +0 -0
- data/lib/{runner.rb → mack-data_mapper/runner.rb} +0 -0
- data/lib/{scaffold_generator → mack-data_mapper/scaffold_generator}/manifest.yml +0 -0
- data/lib/{scaffold_generator → mack-data_mapper/scaffold_generator}/scaffold_generator.rb +0 -0
- data/lib/{scaffold_generator → mack-data_mapper/scaffold_generator}/templates/app/controllers/controller.rb.template +0 -0
- data/lib/{scaffold_generator → mack-data_mapper/scaffold_generator}/templates/app/helpers/controllers/helper.rb.template +0 -0
- data/lib/{scaffold_generator → mack-data_mapper/scaffold_generator}/templates/app/views/edit.html.erb.template +0 -0
- data/lib/{scaffold_generator → mack-data_mapper/scaffold_generator}/templates/app/views/index.html.erb.template +0 -0
- data/lib/{scaffold_generator → mack-data_mapper/scaffold_generator}/templates/app/views/new.html.erb.template +0 -0
- data/lib/{scaffold_generator → mack-data_mapper/scaffold_generator}/templates/app/views/show.html.erb.template +0 -0
- data/lib/{scaffold_generator → mack-data_mapper/scaffold_generator}/templates/test/functional/rspec.rb.template +0 -0
- data/lib/{scaffold_generator → mack-data_mapper/scaffold_generator}/templates/test/functional/test_case.rb.template +0 -0
- data/lib/{tasks → mack-data_mapper/tasks}/db_create_drop_tasks.rake +0 -0
- data/lib/{tasks → mack-data_mapper/tasks}/db_migration_tasks.rake +3 -3
- data/lib/{tasks → mack-data_mapper/tasks}/test_tasks.rake +0 -0
- data/lib/{test_extensions.rb → mack-data_mapper/test_extensions.rb} +3 -3
- data/lib/mack-data_mapper_tasks.rb +1 -1
- metadata +103 -69
- data/doc/classes/DataMapper/Resource.html +0 -154
- data/doc/classes/Mack.html +0 -127
- data/doc/classes/Mack/Database.html +0 -210
- data/doc/classes/Mack/Genosaurus/DataMapper/Helpers.html +0 -225
- data/doc/classes/Mack/Genosaurus/DataMapper/ModelColumn.html +0 -237
- data/doc/classes/Mack/Testing/DataMapperHelpers.html +0 -151
- data/doc/classes/Mack/Testing/Helpers.html +0 -155
- data/doc/classes/Mack/ViewHelpers/DataMapperHelpers.html +0 -279
- data/doc/classes/MigrationGenerator.html +0 -161
- data/doc/classes/ModelGenerator.html +0 -183
- data/doc/classes/ScaffoldGenerator.html +0 -123
- data/doc/created.rid +0 -1
- data/doc/files/README.html +0 -121
- data/doc/files/lib/database_rb.html +0 -101
- data/doc/files/lib/dm_patches/confirmation_validation_rb.html +0 -101
- data/doc/files/lib/dm_patches/dm-cli_rb.html +0 -108
- data/doc/files/lib/dm_patches/migrations_rb.html +0 -101
- data/doc/files/lib/dm_patches/pooling_rb.html +0 -109
- data/doc/files/lib/genosaurus_helpers_rb.html +0 -101
- data/doc/files/lib/helpers/orm_helpers_rb.html +0 -101
- data/doc/files/lib/mack-data_mapper_rb.html +0 -110
- data/doc/files/lib/mack-data_mapper_tasks_rb.html +0 -101
- data/doc/files/lib/migration_generator/migration_generator_rb.html +0 -151
- data/doc/files/lib/model_column_rb.html +0 -101
- data/doc/files/lib/model_generator/model_generator_rb.html +0 -173
- data/doc/files/lib/resource_rb.html +0 -101
- data/doc/files/lib/runner_rb.html +0 -101
- data/doc/files/lib/scaffold_generator/scaffold_generator_rb.html +0 -114
- data/doc/files/lib/test_extensions_rb.html +0 -109
- data/doc/fr_class_index.html +0 -37
- data/doc/fr_file_index.html +0 -43
- data/doc/fr_method_index.html +0 -42
- data/doc/index.html +0 -24
- data/doc/rdoc-style.css +0 -208
- data/lib/dm_patches/confirmation_validation.rb +0 -19
- data/lib/dm_patches/dm-cli.rb +0 -1
- data/lib/dm_patches/migrations.rb +0 -23
- data/lib/dm_patches/pooling.rb +0 -229
@@ -1,151 +0,0 @@
|
|
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>Module: Mack::Testing::DataMapperHelpers</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="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Module</strong></td>
|
53
|
-
<td class="class-name-in-header">Mack::Testing::DataMapperHelpers</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../../files/lib/test_extensions_rb.html">
|
59
|
-
lib/test_extensions.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
</table>
|
66
|
-
</div>
|
67
|
-
<!-- banner header -->
|
68
|
-
|
69
|
-
<div id="bodyContent">
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
<div id="contextContent">
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
</div>
|
78
|
-
|
79
|
-
<div id="method-list">
|
80
|
-
<h3 class="section-bar">Methods</h3>
|
81
|
-
|
82
|
-
<div class="name-list">
|
83
|
-
<a href="#M000016">rollback_transaction</a>
|
84
|
-
</div>
|
85
|
-
</div>
|
86
|
-
|
87
|
-
</div>
|
88
|
-
|
89
|
-
|
90
|
-
<!-- if includes -->
|
91
|
-
|
92
|
-
<div id="section">
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
<!-- if method_list -->
|
102
|
-
<div id="methods">
|
103
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
104
|
-
|
105
|
-
<div id="method-M000016" class="method-detail">
|
106
|
-
<a name="M000016"></a>
|
107
|
-
|
108
|
-
<div class="method-heading">
|
109
|
-
<a href="#M000016" class="method-signature">
|
110
|
-
<span class="method-name">rollback_transaction</span><span class="method-args">() {|if block_given?| ...}</span>
|
111
|
-
</a>
|
112
|
-
</div>
|
113
|
-
|
114
|
-
<div class="method-description">
|
115
|
-
<p><a class="source-toggle" href="#"
|
116
|
-
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
117
|
-
<div class="method-source-code" id="M000016-source">
|
118
|
-
<pre>
|
119
|
-
<span class="ruby-comment cmt"># File lib/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">"Rollback!"</span>
|
126
|
-
36: <span class="ruby-keyword kw">end</span>
|
127
|
-
37: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></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">"Rollback!"</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>
|
134
|
-
</pre>
|
135
|
-
</div>
|
136
|
-
</div>
|
137
|
-
</div>
|
138
|
-
|
139
|
-
|
140
|
-
</div>
|
141
|
-
|
142
|
-
|
143
|
-
</div>
|
144
|
-
|
145
|
-
|
146
|
-
<div id="validator-badges">
|
147
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
148
|
-
</div>
|
149
|
-
|
150
|
-
</body>
|
151
|
-
</html>
|
@@ -1,155 +0,0 @@
|
|
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>Module: Mack::Testing::Helpers</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="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Module</strong></td>
|
53
|
-
<td class="class-name-in-header">Mack::Testing::Helpers</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../../files/lib/test_extensions_rb.html">
|
59
|
-
lib/test_extensions.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
</table>
|
66
|
-
</div>
|
67
|
-
<!-- banner header -->
|
68
|
-
|
69
|
-
<div id="bodyContent">
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
<div id="contextContent">
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
</div>
|
78
|
-
|
79
|
-
<div id="method-list">
|
80
|
-
<h3 class="section-bar">Methods</h3>
|
81
|
-
|
82
|
-
<div class="name-list">
|
83
|
-
<a href="#M000015">rake_task</a>
|
84
|
-
</div>
|
85
|
-
</div>
|
86
|
-
|
87
|
-
</div>
|
88
|
-
|
89
|
-
|
90
|
-
<!-- if includes -->
|
91
|
-
|
92
|
-
<div id="section">
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
<div id="aliases-list">
|
97
|
-
<h3 class="section-bar">External Aliases</h3>
|
98
|
-
|
99
|
-
<div class="name-list">
|
100
|
-
<table summary="aliases">
|
101
|
-
<tr class="top-aligned-row context-row">
|
102
|
-
<td class="context-item-name">rake_task</td>
|
103
|
-
<td>-></td>
|
104
|
-
<td class="context-item-value">mack_rake_task</td>
|
105
|
-
</tr>
|
106
|
-
</table>
|
107
|
-
</div>
|
108
|
-
</div>
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
<!-- if method_list -->
|
115
|
-
<div id="methods">
|
116
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
117
|
-
|
118
|
-
<div id="method-M000015" class="method-detail">
|
119
|
-
<a name="M000015"></a>
|
120
|
-
|
121
|
-
<div class="method-heading">
|
122
|
-
<a href="#M000015" class="method-signature">
|
123
|
-
<span class="method-name">rake_task</span><span class="method-args">(name, env = {})</span>
|
124
|
-
</a>
|
125
|
-
</div>
|
126
|
-
|
127
|
-
<div class="method-description">
|
128
|
-
<p><a class="source-toggle" href="#"
|
129
|
-
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
130
|
-
<div class="method-source-code" id="M000015-source">
|
131
|
-
<pre>
|
132
|
-
<span class="ruby-comment cmt"># File lib/test_extensions.rb, line 18</span>
|
133
|
-
18: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rake_task</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">env</span> = {})
|
134
|
-
19: <span class="ruby-constant">DataMapper</span><span class="ruby-operator">::</span><span class="ruby-constant">MigrationRunner</span>.<span class="ruby-identifier">reset!</span>
|
135
|
-
20: <span class="ruby-identifier">mack_rake_task</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">env</span>, [<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword kw">__FILE__</span>), <span class="ruby-value str">".."</span>, <span class="ruby-value str">"lib"</span>, <span class="ruby-value str">"tasks"</span>, <span class="ruby-value str">"db_create_drop_tasks.rake"</span>),
|
136
|
-
21: <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword kw">__FILE__</span>), <span class="ruby-value str">".."</span>, <span class="ruby-value str">"lib"</span>, <span class="ruby-value str">"tasks"</span>, <span class="ruby-value str">"db_migration_tasks.rake"</span>)])
|
137
|
-
22: <span class="ruby-keyword kw">end</span>
|
138
|
-
</pre>
|
139
|
-
</div>
|
140
|
-
</div>
|
141
|
-
</div>
|
142
|
-
|
143
|
-
|
144
|
-
</div>
|
145
|
-
|
146
|
-
|
147
|
-
</div>
|
148
|
-
|
149
|
-
|
150
|
-
<div id="validator-badges">
|
151
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
152
|
-
</div>
|
153
|
-
|
154
|
-
</body>
|
155
|
-
</html>
|
@@ -1,279 +0,0 @@
|
|
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>Module: Mack::ViewHelpers::DataMapperHelpers</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="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Module</strong></td>
|
53
|
-
<td class="class-name-in-header">Mack::ViewHelpers::DataMapperHelpers</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../../files/lib/helpers/orm_helpers_rb.html">
|
59
|
-
lib/helpers/orm_helpers.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
</table>
|
66
|
-
</div>
|
67
|
-
<!-- banner header -->
|
68
|
-
|
69
|
-
<div id="bodyContent">
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
<div id="contextContent">
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
</div>
|
78
|
-
|
79
|
-
<div id="method-list">
|
80
|
-
<h3 class="section-bar">Methods</h3>
|
81
|
-
|
82
|
-
<div class="name-list">
|
83
|
-
<a href="#M000002">error_messages_for</a>
|
84
|
-
<a href="#M000004">model_password_field</a>
|
85
|
-
<a href="#M000003">model_text_field</a>
|
86
|
-
<a href="#M000005">model_textarea</a>
|
87
|
-
</div>
|
88
|
-
</div>
|
89
|
-
|
90
|
-
</div>
|
91
|
-
|
92
|
-
|
93
|
-
<!-- if includes -->
|
94
|
-
|
95
|
-
<div id="section">
|
96
|
-
|
97
|
-
|
98
|
-
<div id="constants-list">
|
99
|
-
<h3 class="section-bar">Constants</h3>
|
100
|
-
|
101
|
-
<div class="name-list">
|
102
|
-
<table summary="Constants">
|
103
|
-
<tr class="top-aligned-row context-row">
|
104
|
-
<td class="context-item-name">DEFAULT_PARTIAL</td>
|
105
|
-
<td>=</td>
|
106
|
-
<td class="context-item-value">%{ <div> <div class="errorExplanation" id="errorExplanation"> <h2><%= pluralize_word(errors.size, "error") %> occured.</h2> <ul> <% for error in errors %> <li><%= error %></li> <% end %> </ul> </div> </div> } unless Mack::ViewHelpers::DataMapperHelpers.const_defined?("DEFAULT_PARTIAL")</td>
|
107
|
-
</tr>
|
108
|
-
</table>
|
109
|
-
</div>
|
110
|
-
</div>
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
<!-- if method_list -->
|
118
|
-
<div id="methods">
|
119
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
120
|
-
|
121
|
-
<div id="method-M000002" class="method-detail">
|
122
|
-
<a name="M000002"></a>
|
123
|
-
|
124
|
-
<div class="method-heading">
|
125
|
-
<a href="#M000002" class="method-signature">
|
126
|
-
<span class="method-name">error_messages_for</span><span class="method-args">(object_names = [], view_partial = nil)</span>
|
127
|
-
</a>
|
128
|
-
</div>
|
129
|
-
|
130
|
-
<div class="method-description">
|
131
|
-
<p>
|
132
|
-
Provides view level support for printing out all the errors associated with
|
133
|
-
the models you tell it. The DEFAULT_PARTIAL constant provides a simple,
|
134
|
-
default, set of HTML for displaying the errors. If you wish to change this
|
135
|
-
HTML there are two simple ways of doing it. First if you have a partial
|
136
|
-
named: app/views/application/_error_messages.html.erb, then it will use
|
137
|
-
that default, and not DEFAULT_PARTIAL. The other option is to pass in a
|
138
|
-
path to partial as the second argument and that partial will be rendered.
|
139
|
-
</p>
|
140
|
-
<p><a class="source-toggle" href="#"
|
141
|
-
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
|
142
|
-
<div class="method-source-code" id="M000002-source">
|
143
|
-
<pre>
|
144
|
-
<span class="ruby-comment cmt"># File lib/helpers/orm_helpers.rb, line 25</span>
|
145
|
-
25: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">error_messages_for</span>(<span class="ruby-identifier">object_names</span> = [], <span class="ruby-identifier">view_partial</span> = <span class="ruby-keyword kw">nil</span>)
|
146
|
-
26: <span class="ruby-identifier">object_names</span> = [<span class="ruby-identifier">object_names</span>].<span class="ruby-identifier">flatten</span>
|
147
|
-
27: <span class="ruby-identifier">app_errors</span> = []
|
148
|
-
28: <span class="ruby-identifier">object_names</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
|
149
|
-
29: <span class="ruby-identifier">object</span> = <span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-node">"@#{name}"</span>)
|
150
|
-
30: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">object</span>
|
151
|
-
31: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">DataMapper</span><span class="ruby-operator">::</span><span class="ruby-constant">Resource</span>)
|
152
|
-
32: <span class="ruby-identifier">app_errors</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">object</span>.<span class="ruby-identifier">errors</span>.<span class="ruby-identifier">full_messages</span>.<span class="ruby-identifier">uniq</span>
|
153
|
-
33: <span class="ruby-keyword kw">end</span>
|
154
|
-
34: <span class="ruby-keyword kw">end</span>
|
155
|
-
35: <span class="ruby-keyword kw">end</span>
|
156
|
-
36: <span class="ruby-identifier">app_errors</span>.<span class="ruby-identifier">flatten!</span>
|
157
|
-
37: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">app_errors</span>.<span class="ruby-identifier">empty?</span>
|
158
|
-
38: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">view_partial</span>.<span class="ruby-identifier">nil?</span>
|
159
|
-
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">"app"</span>, <span class="ruby-value str">"views"</span>, <span class="ruby-value str">"application"</span>, <span class="ruby-value str">"_error_messages.html.erb"</span>))
|
160
|
-
40: <span class="ruby-identifier">render</span>(<span class="ruby-identifier">:partial</span>, <span class="ruby-value str">"application/error_messages"</span>, <span class="ruby-identifier">:locals</span> =<span class="ruby-operator">></span> {<span class="ruby-identifier">:errors</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">app_errors</span>})
|
161
|
-
41: <span class="ruby-keyword kw">else</span>
|
162
|
-
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">></span> {<span class="ruby-identifier">:errors</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">app_errors</span>})
|
163
|
-
43: <span class="ruby-keyword kw">end</span>
|
164
|
-
44: <span class="ruby-keyword kw">else</span>
|
165
|
-
45: <span class="ruby-identifier">render</span>(<span class="ruby-identifier">:partial</span>, <span class="ruby-identifier">view_partial</span>, <span class="ruby-identifier">:locals</span> =<span class="ruby-operator">></span> {<span class="ruby-identifier">:errors</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">app_errors</span>})
|
166
|
-
46: <span class="ruby-keyword kw">end</span>
|
167
|
-
47: <span class="ruby-keyword kw">else</span>
|
168
|
-
48: <span class="ruby-value str">""</span>
|
169
|
-
49: <span class="ruby-keyword kw">end</span>
|
170
|
-
50: <span class="ruby-keyword kw">end</span>
|
171
|
-
</pre>
|
172
|
-
</div>
|
173
|
-
</div>
|
174
|
-
</div>
|
175
|
-
|
176
|
-
<div id="method-M000004" class="method-detail">
|
177
|
-
<a name="M000004"></a>
|
178
|
-
|
179
|
-
<div class="method-heading">
|
180
|
-
<a href="#M000004" class="method-signature">
|
181
|
-
<span class="method-name">model_password_field</span><span class="method-args">(model, property, options = {})</span>
|
182
|
-
</a>
|
183
|
-
</div>
|
184
|
-
|
185
|
-
<div class="method-description">
|
186
|
-
<p>
|
187
|
-
Generates a password input tag for a given model and field
|
188
|
-
</p>
|
189
|
-
<p>
|
190
|
-
Example: <a
|
191
|
-
href="DataMapperHelpers.html#M000004">model_password_field</a>(@user,
|
192
|
-
:password) # => <input id="user_username"
|
193
|
-
name="user[username]" type="password"
|
194
|
-
value="<@user.username‘s value>" />
|
195
|
-
</p>
|
196
|
-
<p><a class="source-toggle" href="#"
|
197
|
-
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
198
|
-
<div class="method-source-code" id="M000004-source">
|
199
|
-
<pre>
|
200
|
-
<span class="ruby-comment cmt"># File lib/helpers/orm_helpers.rb, line 65</span>
|
201
|
-
65: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">model_password_field</span>(<span class="ruby-identifier">model</span>, <span class="ruby-identifier">property</span>, <span class="ruby-identifier">options</span> = {})
|
202
|
-
66: <span class="ruby-identifier">model_text_field</span>(<span class="ruby-identifier">model</span>, <span class="ruby-identifier">property</span>, {<span class="ruby-identifier">:type</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:password</span>}.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>))
|
203
|
-
67: <span class="ruby-keyword kw">end</span>
|
204
|
-
</pre>
|
205
|
-
</div>
|
206
|
-
</div>
|
207
|
-
</div>
|
208
|
-
|
209
|
-
<div id="method-M000003" class="method-detail">
|
210
|
-
<a name="M000003"></a>
|
211
|
-
|
212
|
-
<div class="method-heading">
|
213
|
-
<a href="#M000003" class="method-signature">
|
214
|
-
<span class="method-name">model_text_field</span><span class="method-args">(model, property, options = {})</span>
|
215
|
-
</a>
|
216
|
-
</div>
|
217
|
-
|
218
|
-
<div class="method-description">
|
219
|
-
<p>
|
220
|
-
Generates a text input tag for a given model and field
|
221
|
-
</p>
|
222
|
-
<p>
|
223
|
-
Example: <a
|
224
|
-
href="DataMapperHelpers.html#M000003">model_text_field</a>(@user,
|
225
|
-
:username) # => <input id="user_username"
|
226
|
-
name="user[username]" type="text"
|
227
|
-
value="<@user.username‘s value>" />
|
228
|
-
</p>
|
229
|
-
<p><a class="source-toggle" href="#"
|
230
|
-
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
|
231
|
-
<div class="method-source-code" id="M000003-source">
|
232
|
-
<pre>
|
233
|
-
<span class="ruby-comment cmt"># File lib/helpers/orm_helpers.rb, line 56</span>
|
234
|
-
56: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">model_text_field</span>(<span class="ruby-identifier">model</span>, <span class="ruby-identifier">property</span>, <span class="ruby-identifier">options</span> = {})
|
235
|
-
57: <span class="ruby-identifier">m_name</span> = <span class="ruby-identifier">model</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">underscore</span>
|
236
|
-
58: <span class="ruby-identifier">non_content_tag</span>(<span class="ruby-identifier">:input</span>, {<span class="ruby-identifier">:type</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:text</span>, <span class="ruby-identifier">:name</span> =<span class="ruby-operator">></span> <span class="ruby-node">"#{m_name}[#{property}]"</span>, <span class="ruby-identifier">:id</span> =<span class="ruby-operator">></span> <span class="ruby-node">"#{m_name}_#{property}"</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">model</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">property</span>)}.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>))
|
237
|
-
59: <span class="ruby-keyword kw">end</span>
|
238
|
-
</pre>
|
239
|
-
</div>
|
240
|
-
</div>
|
241
|
-
</div>
|
242
|
-
|
243
|
-
<div id="method-M000005" class="method-detail">
|
244
|
-
<a name="M000005"></a>
|
245
|
-
|
246
|
-
<div class="method-heading">
|
247
|
-
<a href="#M000005" class="method-signature">
|
248
|
-
<span class="method-name">model_textarea</span><span class="method-args">(model, property, options = {})</span>
|
249
|
-
</a>
|
250
|
-
</div>
|
251
|
-
|
252
|
-
<div class="method-description">
|
253
|
-
<p><a class="source-toggle" href="#"
|
254
|
-
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
255
|
-
<div class="method-source-code" id="M000005-source">
|
256
|
-
<pre>
|
257
|
-
<span class="ruby-comment cmt"># File lib/helpers/orm_helpers.rb, line 69</span>
|
258
|
-
69: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">model_textarea</span>(<span class="ruby-identifier">model</span>, <span class="ruby-identifier">property</span>, <span class="ruby-identifier">options</span> = {})
|
259
|
-
70: <span class="ruby-identifier">m_name</span> = <span class="ruby-identifier">model</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">underscore</span>
|
260
|
-
71: <span class="ruby-identifier">content_tag</span>(<span class="ruby-identifier">:textarea</span>, {<span class="ruby-identifier">:name</span> =<span class="ruby-operator">></span> <span class="ruby-node">"#{m_name}[#{property}]"</span>, <span class="ruby-identifier">:id</span> =<span class="ruby-operator">></span> <span class="ruby-node">"#{m_name}_#{property}"</span>, <span class="ruby-identifier">:cols</span> =<span class="ruby-operator">></span> <span class="ruby-value">60</span>, <span class="ruby-identifier">:rows</span> =<span class="ruby-operator">></span> <span class="ruby-value">20</span>}.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>), <span class="ruby-identifier">model</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">property</span>))
|
261
|
-
72: <span class="ruby-keyword kw">end</span>
|
262
|
-
</pre>
|
263
|
-
</div>
|
264
|
-
</div>
|
265
|
-
</div>
|
266
|
-
|
267
|
-
|
268
|
-
</div>
|
269
|
-
|
270
|
-
|
271
|
-
</div>
|
272
|
-
|
273
|
-
|
274
|
-
<div id="validator-badges">
|
275
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
276
|
-
</div>
|
277
|
-
|
278
|
-
</body>
|
279
|
-
</html>
|