mack-active_record 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/lib/{database.rb → mack-active_record/database.rb} +0 -0
- data/lib/{genosaurus_helpers.rb → mack-active_record/genosaurus_helpers.rb} +0 -0
- data/lib/{helpers → mack-active_record/helpers}/orm_helpers.rb +0 -0
- data/lib/{migration_generator → mack-active_record/migration_generator}/migration_generator.rb +0 -0
- data/lib/{migration_generator → mack-active_record/migration_generator}/templates/db/migrations/%=@migration_name%.rb.template +0 -0
- data/lib/{model_column.rb → mack-active_record/model_column.rb} +0 -0
- data/lib/{model_generator → mack-active_record/model_generator}/manifest.yml +0 -0
- data/lib/{model_generator → mack-active_record/model_generator}/model_generator.rb +0 -0
- data/lib/{model_generator → mack-active_record/model_generator}/templates/model.rb.template +0 -0
- data/lib/{model_generator → mack-active_record/model_generator}/templates/rspec.rb.template +0 -0
- data/lib/{model_generator → mack-active_record/model_generator}/templates/test.rb.template +0 -0
- data/lib/{scaffold_generator → mack-active_record/scaffold_generator}/manifest.yml +0 -0
- data/lib/{scaffold_generator → mack-active_record/scaffold_generator}/scaffold_generator.rb +0 -0
- data/lib/{scaffold_generator → mack-active_record/scaffold_generator}/templates/app/controllers/controller.rb.template +0 -0
- data/lib/{scaffold_generator → mack-active_record/scaffold_generator}/templates/app/views/edit.html.erb.template +0 -0
- data/lib/{scaffold_generator → mack-active_record/scaffold_generator}/templates/app/views/index.html.erb.template +0 -0
- data/lib/{scaffold_generator → mack-active_record/scaffold_generator}/templates/app/views/new.html.erb.template +0 -0
- data/lib/{scaffold_generator → mack-active_record/scaffold_generator}/templates/app/views/show.html.erb.template +0 -0
- data/lib/{scaffold_generator → mack-active_record/scaffold_generator}/templates/spec.rb.template +0 -0
- data/lib/{scaffold_generator → mack-active_record/scaffold_generator}/templates/test.rb.template +0 -0
- data/lib/{tasks → mack-active_record/tasks}/db_create_drop_tasks.rake +0 -0
- data/lib/{tasks → mack-active_record/tasks}/db_migration_tasks.rake +0 -0
- data/lib/mack-active_record.rb +5 -3
- data/lib/mack-active_record_tasks.rb +1 -1
- metadata +25 -51
- data/doc/classes/Mack/Database/Migrator.html +0 -193
- data/doc/classes/Mack/Database.html +0 -224
- data/doc/classes/Mack/Genosaurus/ActiveRecord/Helpers.html +0 -225
- data/doc/classes/Mack/Genosaurus/ActiveRecord/ModelColumn.html +0 -299
- data/doc/classes/Mack/ViewHelpers/ActiveRecordHelpers.html +0 -200
- data/doc/classes/Mack/ViewHelpers.html +0 -111
- data/doc/classes/Mack.html +0 -134
- data/doc/classes/MigrationGenerator.html +0 -159
- data/doc/classes/ModelGenerator.html +0 -174
- data/doc/classes/ScaffoldGenerator.html +0 -123
- data/doc/created.rid +0 -1
- data/doc/files/README.html +0 -111
- data/doc/files/lib/database_rb.html +0 -111
- 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-active_record_rb.html +0 -110
- data/doc/files/lib/mack-active_record_tasks_rb.html +0 -101
- data/doc/files/lib/migration_generator/migration_generator_rb.html +0 -149
- data/doc/files/lib/model_column_rb.html +0 -101
- data/doc/files/lib/model_generator/model_generator_rb.html +0 -164
- data/doc/files/lib/scaffold_generator/scaffold_generator_rb.html +0 -114
- data/doc/fr_class_index.html +0 -36
- data/doc/fr_file_index.html +0 -36
- data/doc/fr_method_index.html +0 -41
- data/doc/index.html +0 -24
- data/doc/rdoc-style.css +0 -208
@@ -1,225 +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::Genosaurus::ActiveRecord::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::Genosaurus::ActiveRecord::Helpers</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../../../files/lib/genosaurus_helpers_rb.html">
|
59
|
-
lib/genosaurus_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">columns</a>
|
84
|
-
<a href="#M000003">db_directory</a>
|
85
|
-
<a href="#M000004">migrations_directory</a>
|
86
|
-
<a href="#M000005">next_migration_number</a>
|
87
|
-
</div>
|
88
|
-
</div>
|
89
|
-
|
90
|
-
</div>
|
91
|
-
|
92
|
-
|
93
|
-
<!-- if includes -->
|
94
|
-
|
95
|
-
<div id="section">
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
<!-- if method_list -->
|
105
|
-
<div id="methods">
|
106
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
107
|
-
|
108
|
-
<div id="method-M000002" class="method-detail">
|
109
|
-
<a name="M000002"></a>
|
110
|
-
|
111
|
-
<div class="method-heading">
|
112
|
-
<a href="#M000002" class="method-signature">
|
113
|
-
<span class="method-name">columns</span><span class="method-args">(name = param(:name))</span>
|
114
|
-
</a>
|
115
|
-
</div>
|
116
|
-
|
117
|
-
<div class="method-description">
|
118
|
-
<p><a class="source-toggle" href="#"
|
119
|
-
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
|
120
|
-
<div class="method-source-code" id="M000002-source">
|
121
|
-
<pre>
|
122
|
-
<span class="ruby-comment cmt"># File lib/genosaurus_helpers.rb, line 6</span>
|
123
|
-
6: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">columns</span>(<span class="ruby-identifier">name</span> = <span class="ruby-identifier">param</span>(<span class="ruby-identifier">:name</span>))
|
124
|
-
7: <span class="ruby-identifier">ivar_cache</span>(<span class="ruby-value str">"form_columns"</span>) <span class="ruby-keyword kw">do</span>
|
125
|
-
8: <span class="ruby-identifier">cs</span> = []
|
126
|
-
9: <span class="ruby-identifier">cols</span> = (<span class="ruby-identifier">param</span>(<span class="ruby-identifier">:cols</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">param</span>(<span class="ruby-identifier">:columns</span>))
|
127
|
-
10: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cols</span>
|
128
|
-
11: <span class="ruby-identifier">cols</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">","</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span>
|
129
|
-
12: <span class="ruby-identifier">cs</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">Genosaurus</span><span class="ruby-operator">::</span><span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">ModelColumn</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">x</span>)
|
130
|
-
13: <span class="ruby-keyword kw">end</span>
|
131
|
-
14: <span class="ruby-keyword kw">end</span>
|
132
|
-
15: <span class="ruby-identifier">cs</span>
|
133
|
-
16: <span class="ruby-keyword kw">end</span>
|
134
|
-
17: <span class="ruby-keyword kw">end</span>
|
135
|
-
</pre>
|
136
|
-
</div>
|
137
|
-
</div>
|
138
|
-
</div>
|
139
|
-
|
140
|
-
<div id="method-M000003" class="method-detail">
|
141
|
-
<a name="M000003"></a>
|
142
|
-
|
143
|
-
<div class="method-heading">
|
144
|
-
<a href="#M000003" class="method-signature">
|
145
|
-
<span class="method-name">db_directory</span><span class="method-args">()</span>
|
146
|
-
</a>
|
147
|
-
</div>
|
148
|
-
|
149
|
-
<div class="method-description">
|
150
|
-
<p><a class="source-toggle" href="#"
|
151
|
-
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
|
152
|
-
<div class="method-source-code" id="M000003-source">
|
153
|
-
<pre>
|
154
|
-
<span class="ruby-comment cmt"># File lib/genosaurus_helpers.rb, line 19</span>
|
155
|
-
19: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">db_directory</span>
|
156
|
-
20: <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">"db"</span>)
|
157
|
-
21: <span class="ruby-keyword kw">end</span>
|
158
|
-
</pre>
|
159
|
-
</div>
|
160
|
-
</div>
|
161
|
-
</div>
|
162
|
-
|
163
|
-
<div id="method-M000004" class="method-detail">
|
164
|
-
<a name="M000004"></a>
|
165
|
-
|
166
|
-
<div class="method-heading">
|
167
|
-
<a href="#M000004" class="method-signature">
|
168
|
-
<span class="method-name">migrations_directory</span><span class="method-args">()</span>
|
169
|
-
</a>
|
170
|
-
</div>
|
171
|
-
|
172
|
-
<div class="method-description">
|
173
|
-
<p><a class="source-toggle" href="#"
|
174
|
-
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
175
|
-
<div class="method-source-code" id="M000004-source">
|
176
|
-
<pre>
|
177
|
-
<span class="ruby-comment cmt"># File lib/genosaurus_helpers.rb, line 23</span>
|
178
|
-
23: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">migrations_directory</span>
|
179
|
-
24: <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">db_directory</span>, <span class="ruby-value str">"migrations"</span>)
|
180
|
-
25: <span class="ruby-keyword kw">end</span>
|
181
|
-
</pre>
|
182
|
-
</div>
|
183
|
-
</div>
|
184
|
-
</div>
|
185
|
-
|
186
|
-
<div id="method-M000005" class="method-detail">
|
187
|
-
<a name="M000005"></a>
|
188
|
-
|
189
|
-
<div class="method-heading">
|
190
|
-
<a href="#M000005" class="method-signature">
|
191
|
-
<span class="method-name">next_migration_number</span><span class="method-args">()</span>
|
192
|
-
</a>
|
193
|
-
</div>
|
194
|
-
|
195
|
-
<div class="method-description">
|
196
|
-
<p><a class="source-toggle" href="#"
|
197
|
-
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
198
|
-
<div class="method-source-code" id="M000005-source">
|
199
|
-
<pre>
|
200
|
-
<span class="ruby-comment cmt"># File lib/genosaurus_helpers.rb, line 27</span>
|
201
|
-
27: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">next_migration_number</span>
|
202
|
-
28: <span class="ruby-identifier">last</span> = <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">glob</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">migrations_directory</span>, <span class="ruby-value str">"*.rb"</span>)).<span class="ruby-identifier">last</span>
|
203
|
-
29: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">last</span>
|
204
|
-
30: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">last</span>).<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/^\d+/</span>).<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">succ</span>
|
205
|
-
31: <span class="ruby-keyword kw">end</span>
|
206
|
-
32: <span class="ruby-keyword kw">return</span> <span class="ruby-value str">"001"</span>
|
207
|
-
33: <span class="ruby-keyword kw">end</span>
|
208
|
-
</pre>
|
209
|
-
</div>
|
210
|
-
</div>
|
211
|
-
</div>
|
212
|
-
|
213
|
-
|
214
|
-
</div>
|
215
|
-
|
216
|
-
|
217
|
-
</div>
|
218
|
-
|
219
|
-
|
220
|
-
<div id="validator-badges">
|
221
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
222
|
-
</div>
|
223
|
-
|
224
|
-
</body>
|
225
|
-
</html>
|
@@ -1,299 +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>Class: Mack::Genosaurus::ActiveRecord::ModelColumn</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>Class</strong></td>
|
53
|
-
<td class="class-name-in-header">Mack::Genosaurus::ActiveRecord::ModelColumn</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../../../files/lib/model_column_rb.html">
|
59
|
-
lib/model_column.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
<tr class="top-aligned-row">
|
66
|
-
<td><strong>Parent:</strong></td>
|
67
|
-
<td>
|
68
|
-
Object
|
69
|
-
</td>
|
70
|
-
</tr>
|
71
|
-
</table>
|
72
|
-
</div>
|
73
|
-
<!-- banner header -->
|
74
|
-
|
75
|
-
<div id="bodyContent">
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
<div id="contextContent">
|
80
|
-
|
81
|
-
<div id="description">
|
82
|
-
<p>
|
83
|
-
Used to represent a ‘column’ from the param cols or columns for
|
84
|
-
generators.
|
85
|
-
</p>
|
86
|
-
|
87
|
-
</div>
|
88
|
-
|
89
|
-
|
90
|
-
</div>
|
91
|
-
|
92
|
-
<div id="method-list">
|
93
|
-
<h3 class="section-bar">Methods</h3>
|
94
|
-
|
95
|
-
<div class="name-list">
|
96
|
-
<a href="#M000008">form_element_id</a>
|
97
|
-
<a href="#M000007">form_element_name</a>
|
98
|
-
<a href="#M000009">form_field</a>
|
99
|
-
<a href="#M000006">new</a>
|
100
|
-
</div>
|
101
|
-
</div>
|
102
|
-
|
103
|
-
</div>
|
104
|
-
|
105
|
-
|
106
|
-
<!-- if includes -->
|
107
|
-
|
108
|
-
<div id="section">
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
<div id="attribute-list">
|
115
|
-
<h3 class="section-bar">Attributes</h3>
|
116
|
-
|
117
|
-
<div class="name-list">
|
118
|
-
<table>
|
119
|
-
<tr class="top-aligned-row context-row">
|
120
|
-
<td class="context-item-name">column_name</td>
|
121
|
-
<td class="context-item-value"> [RW] </td>
|
122
|
-
<td class="context-item-desc">
|
123
|
-
The name of the column.
|
124
|
-
|
125
|
-
</td>
|
126
|
-
</tr>
|
127
|
-
<tr class="top-aligned-row context-row">
|
128
|
-
<td class="context-item-name">column_type</td>
|
129
|
-
<td class="context-item-value"> [RW] </td>
|
130
|
-
<td class="context-item-desc">
|
131
|
-
The type of the column. Ie. string, integer, datetime, etc…
|
132
|
-
|
133
|
-
</td>
|
134
|
-
</tr>
|
135
|
-
<tr class="top-aligned-row context-row">
|
136
|
-
<td class="context-item-name">model_name</td>
|
137
|
-
<td class="context-item-value"> [RW] </td>
|
138
|
-
<td class="context-item-desc">
|
139
|
-
The name of the model associated with the column. Ie. user, post,
|
140
|
-
etc…
|
141
|
-
|
142
|
-
</td>
|
143
|
-
</tr>
|
144
|
-
</table>
|
145
|
-
</div>
|
146
|
-
</div>
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
<!-- if method_list -->
|
151
|
-
<div id="methods">
|
152
|
-
<h3 class="section-bar">Public Class methods</h3>
|
153
|
-
|
154
|
-
<div id="method-M000006" class="method-detail">
|
155
|
-
<a name="M000006"></a>
|
156
|
-
|
157
|
-
<div class="method-heading">
|
158
|
-
<a href="#M000006" class="method-signature">
|
159
|
-
<span class="method-name">new</span><span class="method-args">(model_name, column_unsplit)</span>
|
160
|
-
</a>
|
161
|
-
</div>
|
162
|
-
|
163
|
-
<div class="method-description">
|
164
|
-
<p>
|
165
|
-
Takes in the model_name (user, post, etc…) and the column
|
166
|
-
(username:string, body:text, etc…)
|
167
|
-
</p>
|
168
|
-
<p><a class="source-toggle" href="#"
|
169
|
-
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
170
|
-
<div class="method-source-code" id="M000006-source">
|
171
|
-
<pre>
|
172
|
-
<span class="ruby-comment cmt"># File lib/model_column.rb, line 15</span>
|
173
|
-
15: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">model_name</span>, <span class="ruby-identifier">column_unsplit</span>)
|
174
|
-
16: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">model_name</span> = <span class="ruby-identifier">model_name</span>.<span class="ruby-identifier">singular</span>.<span class="ruby-identifier">underscore</span>
|
175
|
-
17: <span class="ruby-identifier">cols</span> = <span class="ruby-identifier">column_unsplit</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">":"</span>)
|
176
|
-
18: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">column_name</span> = <span class="ruby-identifier">cols</span>.<span class="ruby-identifier">first</span><span class="ruby-comment cmt">#.underscore</span>
|
177
|
-
19: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">column_type</span> = <span class="ruby-identifier">cols</span>.<span class="ruby-identifier">last</span><span class="ruby-comment cmt">#.underscore</span>
|
178
|
-
20: <span class="ruby-keyword kw">end</span>
|
179
|
-
</pre>
|
180
|
-
</div>
|
181
|
-
</div>
|
182
|
-
</div>
|
183
|
-
|
184
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
185
|
-
|
186
|
-
<div id="method-M000008" class="method-detail">
|
187
|
-
<a name="M000008"></a>
|
188
|
-
|
189
|
-
<div class="method-heading">
|
190
|
-
<a href="#M000008" class="method-signature">
|
191
|
-
<span class="method-name">form_element_id</span><span class="method-args">()</span>
|
192
|
-
</a>
|
193
|
-
</div>
|
194
|
-
|
195
|
-
<div class="method-description">
|
196
|
-
<p>
|
197
|
-
Examples:
|
198
|
-
</p>
|
199
|
-
<pre>
|
200
|
-
Mack::Generator::ColumnObject.new("user", "username:string").form_element_id # => "user_username"
|
201
|
-
Mack::Generator::ColumnObject.new("Post", "body:text").form_element_id # => "post_body"
|
202
|
-
</pre>
|
203
|
-
<p><a class="source-toggle" href="#"
|
204
|
-
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
205
|
-
<div class="method-source-code" id="M000008-source">
|
206
|
-
<pre>
|
207
|
-
<span class="ruby-comment cmt"># File lib/model_column.rb, line 32</span>
|
208
|
-
32: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">form_element_id</span>
|
209
|
-
33: <span class="ruby-node">"#{self.model_name}_#{self.column_name}"</span>
|
210
|
-
34: <span class="ruby-keyword kw">end</span>
|
211
|
-
</pre>
|
212
|
-
</div>
|
213
|
-
</div>
|
214
|
-
</div>
|
215
|
-
|
216
|
-
<div id="method-M000007" class="method-detail">
|
217
|
-
<a name="M000007"></a>
|
218
|
-
|
219
|
-
<div class="method-heading">
|
220
|
-
<a href="#M000007" class="method-signature">
|
221
|
-
<span class="method-name">form_element_name</span><span class="method-args">()</span>
|
222
|
-
</a>
|
223
|
-
</div>
|
224
|
-
|
225
|
-
<div class="method-description">
|
226
|
-
<p>
|
227
|
-
Examples:
|
228
|
-
</p>
|
229
|
-
<pre>
|
230
|
-
Mack::Generator::ColumnObject.new("user", "username:string").form_element_name # => "user[username]"
|
231
|
-
Mack::Generator::ColumnObject.new("Post", "body:text").form_element_name # => "post[body]"
|
232
|
-
</pre>
|
233
|
-
<p><a class="source-toggle" href="#"
|
234
|
-
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
235
|
-
<div class="method-source-code" id="M000007-source">
|
236
|
-
<pre>
|
237
|
-
<span class="ruby-comment cmt"># File lib/model_column.rb, line 25</span>
|
238
|
-
25: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">form_element_name</span>
|
239
|
-
26: <span class="ruby-node">"#{self.model_name}[#{self.column_name}]"</span>
|
240
|
-
27: <span class="ruby-keyword kw">end</span>
|
241
|
-
</pre>
|
242
|
-
</div>
|
243
|
-
</div>
|
244
|
-
</div>
|
245
|
-
|
246
|
-
<div id="method-M000009" class="method-detail">
|
247
|
-
<a name="M000009"></a>
|
248
|
-
|
249
|
-
<div class="method-heading">
|
250
|
-
<a href="#M000009" class="method-signature">
|
251
|
-
<span class="method-name">form_field</span><span class="method-args">()</span>
|
252
|
-
</a>
|
253
|
-
</div>
|
254
|
-
|
255
|
-
<div class="method-description">
|
256
|
-
<p>
|
257
|
-
Generates the appropriate HTML form field for the type of column
|
258
|
-
represented.
|
259
|
-
</p>
|
260
|
-
<p>
|
261
|
-
Examples:
|
262
|
-
</p>
|
263
|
-
<pre>
|
264
|
-
Mack::Generator::ColumnObject.new("user", "username:string").form_field
|
265
|
-
=> "<input type="text" name="user[username]" id="user_username" size="30" value="<%= user.username %>" />"
|
266
|
-
Mack::Generator::ColumnObject.new("Post", "body:text").form_field
|
267
|
-
=> "<textarea name="post[body]" id="post_id"><%= post.body %></textarea>"
|
268
|
-
</pre>
|
269
|
-
<p><a class="source-toggle" href="#"
|
270
|
-
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
271
|
-
<div class="method-source-code" id="M000009-source">
|
272
|
-
<pre>
|
273
|
-
<span class="ruby-comment cmt"># File lib/model_column.rb, line 43</span>
|
274
|
-
43: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">form_field</span>
|
275
|
-
44: <span class="ruby-keyword kw">case</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">column_type</span>
|
276
|
-
45: <span class="ruby-keyword kw">when</span> <span class="ruby-value str">"text"</span>
|
277
|
-
46: <span class="ruby-node">%{<textarea name="#{self.form_element_name}" id="#{self.form_element_id}" cols="60" rows="20"><%= @#{self.model_name}.#{self.column_name} %></textarea>}</span>
|
278
|
-
47: <span class="ruby-keyword kw">else</span>
|
279
|
-
48: <span class="ruby-node">%{<input type="text" name="#{self.form_element_name}" id="#{self.form_element_id}" size="30" value="<%= @#{self.model_name}.#{self.column_name} %>" />}</span>
|
280
|
-
49: <span class="ruby-keyword kw">end</span>
|
281
|
-
50: <span class="ruby-keyword kw">end</span>
|
282
|
-
</pre>
|
283
|
-
</div>
|
284
|
-
</div>
|
285
|
-
</div>
|
286
|
-
|
287
|
-
|
288
|
-
</div>
|
289
|
-
|
290
|
-
|
291
|
-
</div>
|
292
|
-
|
293
|
-
|
294
|
-
<div id="validator-badges">
|
295
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
296
|
-
</div>
|
297
|
-
|
298
|
-
</body>
|
299
|
-
</html>
|