ouvrages_scaffold 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -6,74 +6,61 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
6
6
|
add_crumb t("navigation.<%= plural_table_name %>"), <%= plural_table_name %>_path
|
7
7
|
end
|
8
8
|
|
9
|
-
# GET <%= route_url %>
|
10
|
-
# GET <%= route_url %>.json
|
11
9
|
def index
|
12
10
|
respond_to do |format|
|
13
|
-
format.html
|
14
|
-
format.json { render json: <%= "@#{plural_table_name}" %> }
|
11
|
+
format.html
|
12
|
+
# format.json { render json: <%= "@#{plural_table_name}" %> }
|
15
13
|
end
|
16
14
|
end
|
17
15
|
|
18
|
-
# GET <%= route_url %>/1
|
19
|
-
# GET <%= route_url %>/1.json
|
20
16
|
def show
|
21
17
|
respond_to do |format|
|
22
|
-
format.html
|
23
|
-
format.json { render json: <%= "@#{singular_table_name}" %> }
|
18
|
+
format.html
|
19
|
+
# format.json { render json: <%= "@#{singular_table_name}" %> }
|
24
20
|
end
|
25
21
|
end
|
26
22
|
|
27
|
-
# GET <%= route_url %>/new
|
28
|
-
# GET <%= route_url %>/new.json
|
29
23
|
def new
|
30
24
|
respond_to do |format|
|
31
|
-
format.html
|
32
|
-
format.json { render json: <%= "@#{singular_table_name}" %> }
|
25
|
+
format.html
|
26
|
+
# format.json { render json: <%= "@#{singular_table_name}" %> }
|
33
27
|
end
|
34
28
|
end
|
35
29
|
|
36
|
-
# GET <%= route_url %>/1/edit
|
37
30
|
def edit
|
38
31
|
end
|
39
32
|
|
40
|
-
# POST <%= route_url %>
|
41
|
-
# POST <%= route_url %>.json
|
42
33
|
def create
|
43
34
|
respond_to do |format|
|
44
35
|
if @<%= orm_instance.save %>
|
45
36
|
format.html { redirect_to @<%= singular_table_name %>, flash: {success: t("<%= plural_table_name %>.created")} }
|
46
|
-
format.json { render json: <%= "@#{singular_table_name}" %>, status: :created, location: <%= "@#{singular_table_name}" %> }
|
37
|
+
# format.json { render json: <%= "@#{singular_table_name}" %>, status: :created, location: <%= "@#{singular_table_name}" %> }
|
47
38
|
else
|
48
39
|
format.html { render action: "new" }
|
49
|
-
format.json { render json: <%= "@#{orm_instance.errors}" %>, status: :unprocessable_entity }
|
40
|
+
# format.json { render json: <%= "@#{orm_instance.errors}" %>, status: :unprocessable_entity }
|
50
41
|
end
|
51
42
|
end
|
52
43
|
end
|
53
44
|
|
54
|
-
# PATCH/PUT <%= route_url %>/1
|
55
|
-
# PATCH/PUT <%= route_url %>/1.json
|
56
45
|
def update
|
57
46
|
respond_to do |format|
|
58
47
|
if @<%= orm_instance.update_attributes("params[:#{singular_table_name}]") %>
|
59
48
|
format.html { redirect_to @<%= singular_table_name %>, flash: {success: t("<%= plural_table_name %>.updated")} }
|
60
|
-
format.json { head :no_content }
|
49
|
+
# format.json { head :no_content }
|
61
50
|
else
|
62
51
|
format.html { render action: "edit" }
|
63
|
-
format.json { render json: <%= "@#{orm_instance.errors}" %>, status: :unprocessable_entity }
|
52
|
+
# format.json { render json: <%= "@#{orm_instance.errors}" %>, status: :unprocessable_entity }
|
64
53
|
end
|
65
54
|
end
|
66
55
|
end
|
67
56
|
|
68
|
-
# DELETE <%= route_url %>/1
|
69
|
-
# DELETE <%= route_url %>/1.json
|
70
57
|
def destroy
|
71
58
|
@<%= orm_instance.destroy %>
|
72
59
|
|
73
60
|
respond_to do |format|
|
74
61
|
format.html { redirect_to <%= index_helper %>_url, flash: {success: t("<%= plural_table_name %>.removed")} }
|
75
|
-
format.json { head :no_content }
|
62
|
+
# format.json { head :no_content }
|
76
63
|
end
|
77
64
|
end
|
78
65
|
end
|
79
|
-
<% end -%>
|
66
|
+
<% end -%>
|