stefanpenner-my_generator 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/Manifest +32 -0
- data/README.markdown +4 -0
- data/Rakefile +26 -0
- data/TODO +0 -0
- data/VERSION.yml +4 -0
- data/rails_generators/shoulda_model/USAGE +27 -0
- data/rails_generators/shoulda_model/shoulda_model_generator.rb +49 -0
- data/rails_generators/shoulda_model/templates/factory.rb +5 -0
- data/rails_generators/shoulda_model/templates/fixtures.yml +19 -0
- data/rails_generators/shoulda_model/templates/migration.rb +16 -0
- data/rails_generators/shoulda_model/templates/model.rb +2 -0
- data/rails_generators/shoulda_model/templates/unit_test.rb +7 -0
- data/rails_generators/shoulda_scaffold/USAGE +34 -0
- data/rails_generators/shoulda_scaffold/shoulda_scaffold_generator.rb +168 -0
- data/rails_generators/shoulda_scaffold/templates/blueprint/ie.css +22 -0
- data/rails_generators/shoulda_scaffold/templates/blueprint/print.css +29 -0
- data/rails_generators/shoulda_scaffold/templates/blueprint/screen.css +249 -0
- data/rails_generators/shoulda_scaffold/templates/controller.rb +46 -0
- data/rails_generators/shoulda_scaffold/templates/erb/_form.html.erb +8 -0
- data/rails_generators/shoulda_scaffold/templates/erb/edit.html.erb +12 -0
- data/rails_generators/shoulda_scaffold/templates/erb/index.html.erb +22 -0
- data/rails_generators/shoulda_scaffold/templates/erb/layout.html.erb +22 -0
- data/rails_generators/shoulda_scaffold/templates/erb/new.html.erb +8 -0
- data/rails_generators/shoulda_scaffold/templates/erb/show.html.erb +12 -0
- data/rails_generators/shoulda_scaffold/templates/functional_test/basic.rb +66 -0
- data/rails_generators/shoulda_scaffold/templates/functional_test/should_be_restful.rb +13 -0
- data/rails_generators/shoulda_scaffold/templates/haml/_form.html.haml +5 -0
- data/rails_generators/shoulda_scaffold/templates/haml/edit.html.haml +9 -0
- data/rails_generators/shoulda_scaffold/templates/haml/index.html.haml +18 -0
- data/rails_generators/shoulda_scaffold/templates/haml/layout.html.haml +13 -0
- data/rails_generators/shoulda_scaffold/templates/haml/new.html.haml +7 -0
- data/rails_generators/shoulda_scaffold/templates/haml/show.html.haml +9 -0
- data/rails_generators/shoulda_scaffold/templates/helper.rb +2 -0
- data/test/fixtures/about_yml_plugins/bad_about_yml/about.yml +1 -0
- data/test/fixtures/about_yml_plugins/bad_about_yml/init.rb +1 -0
- data/test/fixtures/about_yml_plugins/plugin_without_about_yml/init.rb +1 -0
- data/test/fixtures/eager/zoo.rb +3 -0
- data/test/fixtures/eager/zoo/reptile_house.rb +2 -0
- data/test/fixtures/environment_with_constant.rb +1 -0
- data/test/fixtures/lib/generators/missing_class/missing_class_generator.rb +0 -0
- data/test/fixtures/lib/generators/working/working_generator.rb +2 -0
- data/test/fixtures/plugins/alternate/a/generators/a_generator/a_generator.rb +4 -0
- data/test/fixtures/plugins/default/gemlike/init.rb +1 -0
- data/test/fixtures/plugins/default/gemlike/lib/gemlike.rb +2 -0
- data/test/fixtures/plugins/default/gemlike/rails/init.rb +7 -0
- data/test/fixtures/plugins/default/plugin_with_no_lib_dir/init.rb +0 -0
- data/test/fixtures/plugins/default/stubby/about.yml +2 -0
- data/test/fixtures/plugins/default/stubby/generators/stubby_generator/stubby_generator.rb +4 -0
- data/test/fixtures/plugins/default/stubby/init.rb +7 -0
- data/test/fixtures/plugins/default/stubby/lib/stubby_mixin.rb +2 -0
- data/test/fixtures/tmp/test.log +1 -0
- data/test/rails_generators/shoulda_model_generator_test.rb +39 -0
- data/test/shoulda_macros/generator_macros.rb +36 -0
- data/test/stolen_from_railties.rb +288 -0
- data/test/test_helper.rb +41 -0
- metadata +145 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
/* -----------------------------------------------------------------------
|
2
|
+
|
3
|
+
Blueprint CSS Framework 0.7.1
|
4
|
+
http://blueprintcss.googlecode.com
|
5
|
+
|
6
|
+
* Copyright (c) 2007-2008. See LICENSE for more info.
|
7
|
+
* See README for instructions on how to use Blueprint.
|
8
|
+
* For credits and origins, see AUTHORS.
|
9
|
+
* This is a compressed file. See the sources in the 'src' directory.
|
10
|
+
|
11
|
+
----------------------------------------------------------------------- */
|
12
|
+
|
13
|
+
/* print.css */
|
14
|
+
body {line-height:1.5;font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;color:#000;background:none;font-size:10pt;}
|
15
|
+
.container {background:none;}
|
16
|
+
hr {background:#ccc;color:#ccc;width:100%;height:2px;margin:2em 0;padding:0;border:none;}
|
17
|
+
hr.space {background:#fff;color:#fff;}
|
18
|
+
h1, h2, h3, h4, h5, h6 {font-family:"Helvetica Neue", Arial, "Lucida Grande", sans-serif;}
|
19
|
+
code {font:.9em "Courier New", Monaco, Courier, monospace;}
|
20
|
+
img {float:left;margin:1.5em 1.5em 1.5em 0;}
|
21
|
+
a img {border:none;}
|
22
|
+
p img.top {margin-top:0;}
|
23
|
+
blockquote {margin:1.5em;padding:1em;font-style:italic;font-size:.9em;}
|
24
|
+
.small {font-size:.9em;}
|
25
|
+
.large {font-size:1.1em;}
|
26
|
+
.quiet {color:#999;}
|
27
|
+
.hide {display:none;}
|
28
|
+
a:link, a:visited {background:transparent;font-weight:700;text-decoration:underline;}
|
29
|
+
a:link:after, a:visited:after {content:" (" attr(href) ") ";font-size:90%;}
|
@@ -0,0 +1,249 @@
|
|
1
|
+
/* -----------------------------------------------------------------------
|
2
|
+
|
3
|
+
Blueprint CSS Framework 0.7.1
|
4
|
+
http://blueprintcss.googlecode.com
|
5
|
+
|
6
|
+
* Copyright (c) 2007-2008. See LICENSE for more info.
|
7
|
+
* See README for instructions on how to use Blueprint.
|
8
|
+
* For credits and origins, see AUTHORS.
|
9
|
+
* This is a compressed file. See the sources in the 'src' directory.
|
10
|
+
|
11
|
+
----------------------------------------------------------------------- */
|
12
|
+
|
13
|
+
/* reset.css */
|
14
|
+
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {margin:0;padding:0;border:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline;}
|
15
|
+
body {line-height:1.5;}
|
16
|
+
table {border-collapse:separate;border-spacing:0;}
|
17
|
+
caption, th, td {text-align:left;font-weight:normal;}
|
18
|
+
table, td, th {vertical-align:middle;}
|
19
|
+
blockquote:before, blockquote:after, q:before, q:after {content:"";}
|
20
|
+
blockquote, q {quotes:"" "";}
|
21
|
+
a img {border:none;}
|
22
|
+
|
23
|
+
/* typography.css */
|
24
|
+
body {font-size:75%;color:#222;background:#fff;font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;}
|
25
|
+
h1, h2, h3, h4, h5, h6 {font-weight:normal;color:#111;}
|
26
|
+
h1 {font-size:3em;line-height:1;margin-bottom:0.5em;}
|
27
|
+
h2 {font-size:2em;margin-bottom:0.75em;}
|
28
|
+
h3 {font-size:1.5em;line-height:1;margin-bottom:1em;}
|
29
|
+
h4 {font-size:1.2em;line-height:1.25;margin-bottom:1.25em;height:1.25em;}
|
30
|
+
h5 {font-size:1em;font-weight:bold;margin-bottom:1.5em;}
|
31
|
+
h6 {font-size:1em;font-weight:bold;}
|
32
|
+
h1 img, h2 img, h3 img, h4 img, h5 img, h6 img {margin:0;}
|
33
|
+
p {margin:0 0 1.5em;}
|
34
|
+
p img {float:left;margin:1.5em 1.5em 1.5em 0;padding:0;}
|
35
|
+
p img.right {float:right;margin:1.5em 0 1.5em 1.5em;}
|
36
|
+
a:focus, a:hover {color:#000;}
|
37
|
+
a {color:#009;text-decoration:underline;}
|
38
|
+
blockquote {margin:1.5em;color:#666;font-style:italic;}
|
39
|
+
strong {font-weight:bold;}
|
40
|
+
em, dfn {font-style:italic;}
|
41
|
+
dfn {font-weight:bold;}
|
42
|
+
sup, sub {line-height:0;}
|
43
|
+
abbr, acronym {border-bottom:1px dotted #666;}
|
44
|
+
address {margin:0 0 1.5em;font-style:italic;}
|
45
|
+
del {color:#666;}
|
46
|
+
pre, code {margin:1.5em 0;white-space:pre;}
|
47
|
+
pre, code, tt {font:1em 'andale mono', 'lucida console', monospace;line-height:1.5;}
|
48
|
+
li ul, li ol {margin:0 1.5em;}
|
49
|
+
ul, ol {margin:0 1.5em 1.5em 1.5em;}
|
50
|
+
ul {list-style-type:disc;}
|
51
|
+
ol {list-style-type:decimal;}
|
52
|
+
dl {margin:0 0 1.5em 0;}
|
53
|
+
dl dt {font-weight:bold;}
|
54
|
+
dd {margin-left:1.5em;}
|
55
|
+
table {margin-bottom:1.4em;width:100%;}
|
56
|
+
th {font-weight:bold;background:#C3D9FF;}
|
57
|
+
th, td {padding:4px 10px 4px 5px;}
|
58
|
+
tr.even td {background:#E5ECF9;}
|
59
|
+
tfoot {font-style:italic;}
|
60
|
+
caption {background:#eee;}
|
61
|
+
.small {font-size:.8em;margin-bottom:1.875em;line-height:1.875em;}
|
62
|
+
.large {font-size:1.2em;line-height:2.5em;margin-bottom:1.25em;}
|
63
|
+
.hide {display:none;}
|
64
|
+
.quiet {color:#666;}
|
65
|
+
.loud {color:#000;}
|
66
|
+
.highlight {background:#ff0;}
|
67
|
+
.added {background:#060;color:#fff;}
|
68
|
+
.removed {background:#900;color:#fff;}
|
69
|
+
.first {margin-left:0;padding-left:0;}
|
70
|
+
.last {margin-right:0;padding-right:0;}
|
71
|
+
.top {margin-top:0;padding-top:0;}
|
72
|
+
.bottom {margin-bottom:0;padding-bottom:0;}
|
73
|
+
|
74
|
+
/* grid.css */
|
75
|
+
.container {width:950px;margin:0 auto;}
|
76
|
+
.showgrid {background:url(src/grid.png);}
|
77
|
+
body {margin:1.5em 0;}
|
78
|
+
div.span-1, div.span-2, div.span-3, div.span-4, div.span-5, div.span-6, div.span-7, div.span-8, div.span-9, div.span-10, div.span-11, div.span-12, div.span-13, div.span-14, div.span-15, div.span-16, div.span-17, div.span-18, div.span-19, div.span-20, div.span-21, div.span-22, div.span-23, div.span-24 {float:left;margin-right:10px;}
|
79
|
+
div.last {margin-right:0;}
|
80
|
+
.span-1 {width:30px;}
|
81
|
+
.span-2 {width:70px;}
|
82
|
+
.span-3 {width:110px;}
|
83
|
+
.span-4 {width:150px;}
|
84
|
+
.span-5 {width:190px;}
|
85
|
+
.span-6 {width:230px;}
|
86
|
+
.span-7 {width:270px;}
|
87
|
+
.span-8 {width:310px;}
|
88
|
+
.span-9 {width:350px;}
|
89
|
+
.span-10 {width:390px;}
|
90
|
+
.span-11 {width:430px;}
|
91
|
+
.span-12 {width:470px;}
|
92
|
+
.span-13 {width:510px;}
|
93
|
+
.span-14 {width:550px;}
|
94
|
+
.span-15 {width:590px;}
|
95
|
+
.span-16 {width:630px;}
|
96
|
+
.span-17 {width:670px;}
|
97
|
+
.span-18 {width:710px;}
|
98
|
+
.span-19 {width:750px;}
|
99
|
+
.span-20 {width:790px;}
|
100
|
+
.span-21 {width:830px;}
|
101
|
+
.span-22 {width:870px;}
|
102
|
+
.span-23 {width:910px;}
|
103
|
+
.span-24, div.span-24 {width:950px;margin:0;}
|
104
|
+
.append-1 {padding-right:40px;}
|
105
|
+
.append-2 {padding-right:80px;}
|
106
|
+
.append-3 {padding-right:120px;}
|
107
|
+
.append-4 {padding-right:160px;}
|
108
|
+
.append-5 {padding-right:200px;}
|
109
|
+
.append-6 {padding-right:240px;}
|
110
|
+
.append-7 {padding-right:280px;}
|
111
|
+
.append-8 {padding-right:320px;}
|
112
|
+
.append-9 {padding-right:360px;}
|
113
|
+
.append-10 {padding-right:400px;}
|
114
|
+
.append-11 {padding-right:440px;}
|
115
|
+
.append-12 {padding-right:480px;}
|
116
|
+
.append-13 {padding-right:520px;}
|
117
|
+
.append-14 {padding-right:560px;}
|
118
|
+
.append-15 {padding-right:600px;}
|
119
|
+
.append-16 {padding-right:640px;}
|
120
|
+
.append-17 {padding-right:680px;}
|
121
|
+
.append-18 {padding-right:720px;}
|
122
|
+
.append-19 {padding-right:760px;}
|
123
|
+
.append-20 {padding-right:800px;}
|
124
|
+
.append-21 {padding-right:840px;}
|
125
|
+
.append-22 {padding-right:880px;}
|
126
|
+
.append-23 {padding-right:920px;}
|
127
|
+
.prepend-1 {padding-left:40px;}
|
128
|
+
.prepend-2 {padding-left:80px;}
|
129
|
+
.prepend-3 {padding-left:120px;}
|
130
|
+
.prepend-4 {padding-left:160px;}
|
131
|
+
.prepend-5 {padding-left:200px;}
|
132
|
+
.prepend-6 {padding-left:240px;}
|
133
|
+
.prepend-7 {padding-left:280px;}
|
134
|
+
.prepend-8 {padding-left:320px;}
|
135
|
+
.prepend-9 {padding-left:360px;}
|
136
|
+
.prepend-10 {padding-left:400px;}
|
137
|
+
.prepend-11 {padding-left:440px;}
|
138
|
+
.prepend-12 {padding-left:480px;}
|
139
|
+
.prepend-13 {padding-left:520px;}
|
140
|
+
.prepend-14 {padding-left:560px;}
|
141
|
+
.prepend-15 {padding-left:600px;}
|
142
|
+
.prepend-16 {padding-left:640px;}
|
143
|
+
.prepend-17 {padding-left:680px;}
|
144
|
+
.prepend-18 {padding-left:720px;}
|
145
|
+
.prepend-19 {padding-left:760px;}
|
146
|
+
.prepend-20 {padding-left:800px;}
|
147
|
+
.prepend-21 {padding-left:840px;}
|
148
|
+
.prepend-22 {padding-left:880px;}
|
149
|
+
.prepend-23 {padding-left:920px;}
|
150
|
+
div.border {padding-right:4px;margin-right:5px;border-right:1px solid #eee;}
|
151
|
+
div.colborder {padding-right:24px;margin-right:25px;border-right:1px solid #eee;}
|
152
|
+
.pull-1 {margin-left:-40px;}
|
153
|
+
.pull-2 {margin-left:-80px;}
|
154
|
+
.pull-3 {margin-left:-120px;}
|
155
|
+
.pull-4 {margin-left:-160px;}
|
156
|
+
.pull-5 {margin-left:-200px;}
|
157
|
+
.pull-6 {margin-left:-240px;}
|
158
|
+
.pull-7 {margin-left:-280px;}
|
159
|
+
.pull-8 {margin-left:-320px;}
|
160
|
+
.pull-9 {margin-left:-360px;}
|
161
|
+
.pull-10 {margin-left:-400px;}
|
162
|
+
.pull-11 {margin-left:-440px;}
|
163
|
+
.pull-12 {margin-left:-480px;}
|
164
|
+
.pull-13 {margin-left:-520px;}
|
165
|
+
.pull-14 {margin-left:-560px;}
|
166
|
+
.pull-15 {margin-left:-600px;}
|
167
|
+
.pull-16 {margin-left:-640px;}
|
168
|
+
.pull-17 {margin-left:-680px;}
|
169
|
+
.pull-18 {margin-left:-720px;}
|
170
|
+
.pull-19 {margin-left:-760px;}
|
171
|
+
.pull-20 {margin-left:-800px;}
|
172
|
+
.pull-21 {margin-left:-840px;}
|
173
|
+
.pull-22 {margin-left:-880px;}
|
174
|
+
.pull-23 {margin-left:-920px;}
|
175
|
+
.pull-24 {margin-left:-960px;}
|
176
|
+
.pull-1, .pull-2, .pull-3, .pull-4, .pull-5, .pull-6, .pull-7, .pull-8, .pull-9, .pull-10, .pull-11, .pull-12, .pull-13, .pull-14, .pull-15, .pull-16, .pull-17, .pull-18, .pull-19, .pull-20, .pull-21, .pull-22, .pull-23, .pull-24 {float:left;position:relative;}
|
177
|
+
.push-1 {margin:0 -40px 1.5em 40px;}
|
178
|
+
.push-2 {margin:0 -80px 1.5em 80px;}
|
179
|
+
.push-3 {margin:0 -120px 1.5em 120px;}
|
180
|
+
.push-4 {margin:0 -160px 1.5em 160px;}
|
181
|
+
.push-5 {margin:0 -200px 1.5em 200px;}
|
182
|
+
.push-6 {margin:0 -240px 1.5em 240px;}
|
183
|
+
.push-7 {margin:0 -280px 1.5em 280px;}
|
184
|
+
.push-8 {margin:0 -320px 1.5em 320px;}
|
185
|
+
.push-9 {margin:0 -360px 1.5em 360px;}
|
186
|
+
.push-10 {margin:0 -400px 1.5em 400px;}
|
187
|
+
.push-11 {margin:0 -440px 1.5em 440px;}
|
188
|
+
.push-12 {margin:0 -480px 1.5em 480px;}
|
189
|
+
.push-13 {margin:0 -520px 1.5em 520px;}
|
190
|
+
.push-14 {margin:0 -560px 1.5em 560px;}
|
191
|
+
.push-15 {margin:0 -600px 1.5em 600px;}
|
192
|
+
.push-16 {margin:0 -640px 1.5em 640px;}
|
193
|
+
.push-17 {margin:0 -680px 1.5em 680px;}
|
194
|
+
.push-18 {margin:0 -720px 1.5em 720px;}
|
195
|
+
.push-19 {margin:0 -760px 1.5em 760px;}
|
196
|
+
.push-20 {margin:0 -800px 1.5em 800px;}
|
197
|
+
.push-21 {margin:0 -840px 1.5em 840px;}
|
198
|
+
.push-22 {margin:0 -880px 1.5em 880px;}
|
199
|
+
.push-23 {margin:0 -920px 1.5em 920px;}
|
200
|
+
.push-24 {margin:0 -960px 1.5em 960px;}
|
201
|
+
.push-1, .push-2, .push-3, .push-4, .push-5, .push-6, .push-7, .push-8, .push-9, .push-10, .push-11, .push-12, .push-13, .push-14, .push-15, .push-16, .push-17, .push-18, .push-19, .push-20, .push-21, .push-22, .push-23, .push-24 {float:right;position:relative;}
|
202
|
+
.box {padding:1.5em;margin-bottom:1.5em;background:#E5ECF9;}
|
203
|
+
hr {background:#ddd;color:#ddd;clear:both;float:none;width:100%;height:.1em;margin:0 0 1.45em;border:none;}
|
204
|
+
hr.space {background:#fff;color:#fff;}
|
205
|
+
.clearfix:after, .container:after {content:".";display:block;height:0;clear:both;visibility:hidden;}
|
206
|
+
.clearfix, .container {display:inline-block;}
|
207
|
+
* html .clearfix, * html .container {height:1%;}
|
208
|
+
.clearfix, .container {display:block;}
|
209
|
+
.clear {clear:both;}
|
210
|
+
|
211
|
+
/* forms.css */
|
212
|
+
label {font-weight:bold;}
|
213
|
+
fieldset {padding:1.4em;margin:0 0 1.5em 0;border:1px solid #ccc;}
|
214
|
+
legend {font-weight:bold;font-size:1.2em;}
|
215
|
+
input.text, input.title, textarea, select {margin:0.5em 0;border:1px solid #bbb;}
|
216
|
+
input.text:focus, input.title:focus, textarea:focus, select:focus {border:1px solid #666;}
|
217
|
+
input.text, input.title {padding:5px;}
|
218
|
+
input.title {font-size:1.5em;}
|
219
|
+
textarea {width:390px;height:250px;padding:5px;}
|
220
|
+
.error, .notice, .success {padding:.8em;margin-bottom:1em;border:2px solid #ddd;}
|
221
|
+
.error {background:#FBE3E4;color:#8a1f11;border-color:#FBC2C4;}
|
222
|
+
.notice {background:#FFF6BF;color:#514721;border-color:#FFD324;}
|
223
|
+
.success {background:#E6EFC2;color:#264409;border-color:#C6D880;}
|
224
|
+
.error a {color:#8a1f11;}
|
225
|
+
.notice a {color:#514721;}
|
226
|
+
.success a {color:#264409;}
|
227
|
+
|
228
|
+
.error_message{
|
229
|
+
color:#FBC2C4;
|
230
|
+
font-weight:bold;
|
231
|
+
margin-left:1em;
|
232
|
+
}
|
233
|
+
|
234
|
+
.fieldWithErrors input,
|
235
|
+
.fieldWithErrors textarea{
|
236
|
+
background-color:#FBE3E4;
|
237
|
+
border: 2px solid #FBC2C4;
|
238
|
+
}
|
239
|
+
|
240
|
+
#errorExplanation p {
|
241
|
+
color: #333;
|
242
|
+
margin-bottom: 0;
|
243
|
+
padding: 5px;
|
244
|
+
}
|
245
|
+
#errorExplanation ul li {
|
246
|
+
font-size: 12px;
|
247
|
+
list-style: square;
|
248
|
+
}
|
249
|
+
|
@@ -0,0 +1,46 @@
|
|
1
|
+
class <%= controller_class_name %>Controller < ApplicationController
|
2
|
+
def index
|
3
|
+
@<%= table_name %> = <%= class_name %>.find(:all)
|
4
|
+
end
|
5
|
+
|
6
|
+
def show
|
7
|
+
@<%= file_name %> = <%= class_name %>.find(params[:id])
|
8
|
+
end
|
9
|
+
|
10
|
+
def new
|
11
|
+
@<%= file_name %> = <%= class_name %>.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def edit
|
15
|
+
@<%= file_name %> = <%= class_name %>.find(params[:id])
|
16
|
+
end
|
17
|
+
|
18
|
+
def create
|
19
|
+
@<%= file_name %> = <%= class_name %>.new(params[:<%= file_name %>])
|
20
|
+
|
21
|
+
if @<%= file_name %>.save
|
22
|
+
flash[:notice] = '<%= singular_name.humanize %> was successfully created.'
|
23
|
+
redirect_to(@<%= file_name %>)
|
24
|
+
else
|
25
|
+
render :action => "new"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def update
|
30
|
+
@<%= file_name %> = <%= class_name %>.find(params[:id])
|
31
|
+
|
32
|
+
if @<%= file_name %>.update_attributes(params[:<%= file_name %>])
|
33
|
+
flash[:notice] = '<%= singular_name.humanize %> was successfully updated.'
|
34
|
+
redirect_to(@<%= file_name %>)
|
35
|
+
else
|
36
|
+
render :action => "edit"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def destroy
|
41
|
+
@<%= file_name %> = <%= class_name %>.find(params[:id])
|
42
|
+
@<%= file_name %>.destroy
|
43
|
+
|
44
|
+
redirect_to(<%= table_name %>_url)
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<h1>Editing <%= singular_name.humanize %></h1>
|
2
|
+
|
3
|
+
<%% form_for(@<%= singular_name %>) do |form| %>
|
4
|
+
<%%= render :partial => 'form', :locals => {:form => form} %>
|
5
|
+
<p><%%= form.submit 'Update' %></p>
|
6
|
+
<%% end %>
|
7
|
+
|
8
|
+
<p>
|
9
|
+
<%%= link_to 'Show', @<%= singular_name %> %>
|
10
|
+
|
|
11
|
+
<%%= link_to 'Back', <%= plural_name %>_path %>
|
12
|
+
</p>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<h1> Listing <%= plural_name.humanize %></h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
<% for attribute in attributes -%>
|
6
|
+
<th><%= attribute.column.human_name %></th>
|
7
|
+
<% end -%>
|
8
|
+
</tr>
|
9
|
+
|
10
|
+
<%% for <%= singular_name %> in @<%= plural_name %> %>
|
11
|
+
<tr>
|
12
|
+
<% for attribute in attributes -%>
|
13
|
+
<td><%%= h <%= singular_name %>.<%= attribute.name %> %></td>
|
14
|
+
<% end -%>
|
15
|
+
<td><%%= link_to 'Show', <%= singular_name %> %></td>
|
16
|
+
<td><%%= link_to 'Edit', edit_<%= singular_name %>_path(<%= singular_name %>) %></td>
|
17
|
+
<td><%%= link_to 'Destroy', <%= singular_name %>, :confirm => 'Are you sure?', :method => :delete %></td>
|
18
|
+
</tr>
|
19
|
+
<%% end %>
|
20
|
+
</table>
|
21
|
+
|
22
|
+
<p><%%= link_to 'New <%= singular_name.humanize %>', new_<%= singular_name %>_path %></p>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title><%%= "#{controller.controller_name}: #{controller.action_name}" %></title>
|
5
|
+
<%%= stylesheet_link_tag 'blueprint/screen', :media => 'screen' %>
|
6
|
+
<%%= stylesheet_link_tag 'blueprint/print', :media => 'print' %>
|
7
|
+
<%%= "<!--[if IE]>#{stylesheet_link_tag 'blueprint/ie', :media => 'screen'}<![endif]-->" %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<div class="container">
|
11
|
+
<div id="content" class="column span-24">
|
12
|
+
<%% flash.each do |key, value| -%>
|
13
|
+
<div class="<%%= key %>">
|
14
|
+
<%%= h(value) %>
|
15
|
+
</div>
|
16
|
+
<%% end %>
|
17
|
+
|
18
|
+
<%%= yield %>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
</body>
|
22
|
+
</html>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<h1>New <%= singular_name.humanize %></h1>
|
2
|
+
|
3
|
+
<%% form_for(@<%= singular_name %>) do |form| %>
|
4
|
+
<%%= render :partial => 'form', :locals => {:form => form} %>
|
5
|
+
<p><%%= form.submit 'Create' %></p>
|
6
|
+
<%% end %>
|
7
|
+
|
8
|
+
<p><%%= link_to 'Back', <%= plural_name %>_path %></p>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<dl>
|
2
|
+
<% for attribute in attributes -%>
|
3
|
+
<dt><%= attribute.column.human_name %></dt>
|
4
|
+
<dd><%%= h @<%= singular_name %>.<%= attribute.name %> %></dd>
|
5
|
+
<% end -%>
|
6
|
+
</dl>
|
7
|
+
|
8
|
+
<p>
|
9
|
+
<%%= link_to 'Edit', edit_<%= singular_name %>_path(@<%= singular_name %>)%>
|
10
|
+
|
|
11
|
+
<%%= link_to 'Back', <%= plural_name %>_path %>
|
12
|
+
</p>
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
2
|
+
|
3
|
+
class <%= controller_class_name %>ControllerTest < ActionController::TestCase
|
4
|
+
context 'GET to index' do
|
5
|
+
setup do
|
6
|
+
get :index
|
7
|
+
end
|
8
|
+
should_respond_with :success
|
9
|
+
should_assign_to :<%= table_name %>
|
10
|
+
end
|
11
|
+
|
12
|
+
context 'GET to new' do
|
13
|
+
setup do
|
14
|
+
get :new
|
15
|
+
end
|
16
|
+
|
17
|
+
should_respond_with :success
|
18
|
+
should_render_template :new
|
19
|
+
should_assign_to :<%= file_name %>
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'POST to create' do
|
23
|
+
setup do
|
24
|
+
post :create, :<%= file_name %> => Factory.attributes_for(:<%= file_name %>)
|
25
|
+
@<%= file_name %> = <%= class_name %>.find(:all).last
|
26
|
+
end
|
27
|
+
|
28
|
+
should_redirect_to '<%= file_name %>_path(@<%= file_name %>)'
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'GET to show' do
|
32
|
+
setup do
|
33
|
+
@<%= file_name %> = Factory(:<%= file_name %>)
|
34
|
+
get :show, :id => @<%= file_name %>.id
|
35
|
+
end
|
36
|
+
should_respond_with :success
|
37
|
+
should_render_template :show
|
38
|
+
should_assign_to :<%= file_name %>
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'GET to edit' do
|
42
|
+
setup do
|
43
|
+
@<%= file_name %> = Factory(:<%= file_name %>)
|
44
|
+
get :edit, :id => @<%= file_name %>.id
|
45
|
+
end
|
46
|
+
should_respond_with :success
|
47
|
+
should_render_template :edit
|
48
|
+
should_assign_to :<%= file_name %>
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'PUT to update' do
|
52
|
+
setup do
|
53
|
+
@<%= file_name %> = Factory(:<%= file_name %>)
|
54
|
+
put :update, :id => @<%= file_name %>.id, :<%= file_name %> => Factory.attributes_for(:<%= file_name %>)
|
55
|
+
end
|
56
|
+
should_redirect_to '<%= file_name %>_path(@<%= file_name %>)'
|
57
|
+
end
|
58
|
+
|
59
|
+
context 'DELETE to destroy' do
|
60
|
+
setup do
|
61
|
+
@<%= file_name %> = Factory(:<%= file_name %>)
|
62
|
+
delete :destroy, :id => @<%= file_name %>.id
|
63
|
+
end
|
64
|
+
should_redirect_to '<%= table_name %>_path'
|
65
|
+
end
|
66
|
+
end
|