dm-haml-scaffold-generator 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
RSpec Haml Scaffold Generator
|
1
|
+
DataMapper + RSpec + Haml + FactoryGirl Scaffold Generator
|
2
2
|
====
|
3
3
|
|
4
|
-
This is an uber version of the RSpec Scaffold Generator, the following things have been added:
|
4
|
+
This is an super - uber version of the RSpec Scaffold Generator, the following things have been added:
|
5
5
|
|
6
|
+
DataMapper
|
6
7
|
Support for Haml instead of erb
|
7
8
|
Nested routes (nested tests/migrations)
|
8
9
|
|
9
|
-
|
10
|
-
sudo gem install zachinglis-rspec-haml-scaffold
|
10
|
+
Also assumes you're using factory girl and factory girl extensions.
|
11
11
|
|
12
12
|
Examples:
|
13
13
|
|
14
14
|
./script/generate dm_haml_scaffold post # no attributes, view will be anemic
|
15
|
-
./script/generate dm_haml_scaffold post attribute:string attribute:boolean
|
15
|
+
./script/generate dm_haml_scaffold post attribute:string attribute:boolean
|
16
16
|
|
17
17
|
Credits
|
18
|
-
|
19
18
|
* Daniel Fischer - http://danielfischer.com
|
20
19
|
* Zach Inglis - http://zachinglis.com
|
20
|
+
* BM5k - http://me.bm5k.com
|
@@ -1,15 +1,16 @@
|
|
1
|
-
RSpec Haml Scaffold Generator
|
1
|
+
DataMapper + RSpec + Haml + FactoryGirl Scaffold Generator
|
2
2
|
====
|
3
3
|
|
4
4
|
This is an super - uber version of the RSpec Scaffold Generator, the following things have been added:
|
5
5
|
|
6
|
+
DataMapper
|
6
7
|
Support for Haml instead of erb
|
7
8
|
Nested routes (nested tests/migrations)
|
8
|
-
|
9
|
+
|
9
10
|
|
10
11
|
Also assumes you're using factory girl and factory girl extensions.
|
11
12
|
|
12
13
|
Examples:
|
13
14
|
|
14
|
-
./script
|
15
|
-
./script
|
15
|
+
./script/generate dm_haml_scaffold post # no attributes, view will be anemic
|
16
|
+
./script/generate dm_haml_scaffold post attribute:string attribute:boolean
|
@@ -1,8 +1,9 @@
|
|
1
1
|
class <%= controller_class_name %>Controller < ApplicationController
|
2
|
-
|
3
|
-
# GET /<%=
|
2
|
+
|
3
|
+
# GET /<%= plural_name %>
|
4
|
+
# GET /<%= plural_name %>.xml
|
4
5
|
def index
|
5
|
-
@<%= plural_name %> = <%=
|
6
|
+
@<%= plural_name %> = <%= model_name %>.all
|
6
7
|
|
7
8
|
respond_to do |format|
|
8
9
|
format.html # index.html.haml
|
@@ -10,10 +11,10 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
10
11
|
end
|
11
12
|
end
|
12
13
|
|
13
|
-
# GET /<%=
|
14
|
-
# GET /<%=
|
14
|
+
# GET /<%= plural_name %>/1
|
15
|
+
# GET /<%= plural_name %>/1.xml
|
15
16
|
def show
|
16
|
-
@<%= singular_name %> = <%=
|
17
|
+
@<%= singular_name %> = <%= model_name %>.get params[:id]
|
17
18
|
|
18
19
|
respond_to do |format|
|
19
20
|
format.html # show.html.haml
|
@@ -21,10 +22,10 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
24
|
-
# GET /<%=
|
25
|
-
# GET /<%=
|
25
|
+
# GET /<%= plural_name %>/new
|
26
|
+
# GET /<%= plural_name %>/new.xml
|
26
27
|
def new
|
27
|
-
@<%= singular_name %> = <%=
|
28
|
+
@<%= singular_name %> = <%= model_name %>.new
|
28
29
|
|
29
30
|
respond_to do |format|
|
30
31
|
format.html # new.html.haml
|
@@ -32,20 +33,20 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
35
|
-
# GET /<%=
|
36
|
+
# GET /<%= plural_name %>/1/edit
|
36
37
|
def edit
|
37
|
-
@<%= singular_name %> = <%=
|
38
|
+
@<%= singular_name %> = <%= model_name %>.get params[:id]
|
38
39
|
end
|
39
40
|
|
40
|
-
# POST /<%=
|
41
|
-
# POST /<%=
|
41
|
+
# POST /<%= plural_name %>
|
42
|
+
# POST /<%= plural_name %>.xml
|
42
43
|
def create
|
43
|
-
@<%= file_name %> = <%=
|
44
|
+
@<%= file_name %> = <%= model_name %>.new params[:<%= singular_name %>]
|
44
45
|
|
45
46
|
respond_to do |format|
|
46
47
|
if @<%= file_name %>.save
|
47
|
-
flash[:notice] = '<%=
|
48
|
-
format.html { redirect_to
|
48
|
+
flash[:notice] = '<%= model_name %> was successfully created!'
|
49
|
+
format.html { redirect_to <%= table_name.singularize %>_path(@<%= file_name %>) }
|
49
50
|
format.xml { render :xml => @<%= file_name %>, :status => :created, :location => @<%= file_name %> }
|
50
51
|
else
|
51
52
|
format.html { render :action => "new" }
|
@@ -54,15 +55,15 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
54
55
|
end
|
55
56
|
end
|
56
57
|
|
57
|
-
# PUT /<%=
|
58
|
-
# PUT /<%=
|
58
|
+
# PUT /<%= plural_name %>/1
|
59
|
+
# PUT /<%= plural_name %>/1.xml
|
59
60
|
def update
|
60
|
-
@<%= file_name %> = <%=
|
61
|
+
@<%= file_name %> = <%= model_name %>.get params[:id]
|
61
62
|
|
62
63
|
respond_to do |format|
|
63
|
-
if @<%= file_name %>.update_attributes
|
64
|
-
flash[:notice] = '<%= singular_name.capitalize %> was successfully updated
|
65
|
-
format.html { redirect_to
|
64
|
+
if @<%= file_name %>.update_attributes params[:<%= file_name %>]
|
65
|
+
flash[:notice] = '<%= singular_name.capitalize %> was successfully updated!'
|
66
|
+
format.html { redirect_to <%= table_name.singularize %>_path(@<%= file_name %>) }
|
66
67
|
format.xml { head :ok }
|
67
68
|
else
|
68
69
|
format.html { render :action => "edit" }
|
@@ -71,15 +72,16 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
71
72
|
end
|
72
73
|
end
|
73
74
|
|
74
|
-
# DELETE /<%=
|
75
|
-
# DELETE /<%=
|
75
|
+
# DELETE /<%= plural_name %>/1
|
76
|
+
# DELETE /<%= plural_name %>/1.xml
|
76
77
|
def destroy
|
77
|
-
@<%= file_name %> = <%=
|
78
|
+
@<%= file_name %> = <%= model_name %>.get params[:id]
|
78
79
|
@<%= file_name %>.destroy
|
79
80
|
|
80
81
|
respond_to do |format|
|
81
|
-
format.html { redirect_to
|
82
|
+
format.html { redirect_to <%= table_name %>_url }
|
82
83
|
format.xml { head :ok }
|
83
84
|
end
|
84
85
|
end
|
86
|
+
|
85
87
|
end
|