fizx-collapsed_routes 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +5 -0
- data/LICENSE +20 -0
- data/README.rdoc +86 -0
- data/Rakefile +48 -0
- data/VERSION +1 -0
- data/collapsed_routes.gemspec +136 -0
- data/lib/collapsed_routes.rb +53 -0
- data/spec/app/README +243 -0
- data/spec/app/Rakefile +10 -0
- data/spec/app/app/controllers/application_controller.rb +10 -0
- data/spec/app/app/controllers/comments_controller.rb +85 -0
- data/spec/app/app/controllers/posts_controller.rb +85 -0
- data/spec/app/app/controllers/users_controller.rb +85 -0
- data/spec/app/app/helpers/application_helper.rb +3 -0
- data/spec/app/app/helpers/comments_helper.rb +2 -0
- data/spec/app/app/helpers/posts_helper.rb +2 -0
- data/spec/app/app/helpers/users_helper.rb +2 -0
- data/spec/app/app/models/comment.rb +3 -0
- data/spec/app/app/models/post.rb +4 -0
- data/spec/app/app/models/user.rb +3 -0
- data/spec/app/app/views/comments/edit.html.erb +24 -0
- data/spec/app/app/views/comments/index.html.erb +24 -0
- data/spec/app/app/views/comments/new.html.erb +23 -0
- data/spec/app/app/views/comments/show.html.erb +18 -0
- data/spec/app/app/views/layouts/comments.html.erb +17 -0
- data/spec/app/app/views/layouts/posts.html.erb +17 -0
- data/spec/app/app/views/layouts/users.html.erb +17 -0
- data/spec/app/app/views/posts/edit.html.erb +24 -0
- data/spec/app/app/views/posts/index.html.erb +24 -0
- data/spec/app/app/views/posts/new.html.erb +23 -0
- data/spec/app/app/views/posts/show.html.erb +18 -0
- data/spec/app/app/views/users/edit.html.erb +16 -0
- data/spec/app/app/views/users/index.html.erb +20 -0
- data/spec/app/app/views/users/new.html.erb +15 -0
- data/spec/app/app/views/users/show.html.erb +8 -0
- data/spec/app/config/boot.rb +110 -0
- data/spec/app/config/database.yml +22 -0
- data/spec/app/config/environment.rb +41 -0
- data/spec/app/config/environments/development.rb +17 -0
- data/spec/app/config/environments/production.rb +28 -0
- data/spec/app/config/environments/test.rb +28 -0
- data/spec/app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/app/config/initializers/inflections.rb +10 -0
- data/spec/app/config/initializers/mime_types.rb +5 -0
- data/spec/app/config/initializers/new_rails_defaults.rb +19 -0
- data/spec/app/config/initializers/session_store.rb +15 -0
- data/spec/app/config/locales/en.yml +5 -0
- data/spec/app/config/routes.rb +7 -0
- data/spec/app/db/migrate/20090623181503_create_users.rb +13 -0
- data/spec/app/db/migrate/20090623181555_create_posts.rb +15 -0
- data/spec/app/db/migrate/20090623181609_create_comments.rb +15 -0
- data/spec/app/db/schema.rb +36 -0
- data/spec/app/db/test.sqlite3 +0 -0
- data/spec/app/doc/README_FOR_APP +2 -0
- data/spec/app/lib/tasks/rspec.rake +167 -0
- data/spec/app/log/.gitignore +1 -0
- data/spec/app/script/about +4 -0
- data/spec/app/script/autospec +6 -0
- data/spec/app/script/console +3 -0
- data/spec/app/script/dbconsole +3 -0
- data/spec/app/script/destroy +3 -0
- data/spec/app/script/generate +3 -0
- data/spec/app/script/performance/benchmarker +3 -0
- data/spec/app/script/performance/profiler +3 -0
- data/spec/app/script/plugin +3 -0
- data/spec/app/script/runner +3 -0
- data/spec/app/script/server +3 -0
- data/spec/app/script/spec +10 -0
- data/spec/app/script/spec_server +9 -0
- data/spec/app/tmp/.gitignore +4 -0
- data/spec/collapsed_routes_spec.rb +39 -0
- data/spec/spec_helper.rb +13 -0
- metadata +153 -0
@@ -0,0 +1,85 @@
|
|
1
|
+
class CommentsController < ApplicationController
|
2
|
+
# GET /comments
|
3
|
+
# GET /comments.xml
|
4
|
+
def index
|
5
|
+
@comments = Comment.all
|
6
|
+
|
7
|
+
respond_to do |format|
|
8
|
+
format.html # index.html.erb
|
9
|
+
format.xml { render :xml => @comments }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /comments/1
|
14
|
+
# GET /comments/1.xml
|
15
|
+
def show
|
16
|
+
@comment = Comment.find(params[:id])
|
17
|
+
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # show.html.erb
|
20
|
+
format.xml { render :xml => @comment }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /comments/new
|
25
|
+
# GET /comments/new.xml
|
26
|
+
def new
|
27
|
+
@comment = Comment.new
|
28
|
+
|
29
|
+
respond_to do |format|
|
30
|
+
format.html # new.html.erb
|
31
|
+
format.xml { render :xml => @comment }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# GET /comments/1/edit
|
36
|
+
def edit
|
37
|
+
@comment = Comment.find(params[:id])
|
38
|
+
end
|
39
|
+
|
40
|
+
# POST /comments
|
41
|
+
# POST /comments.xml
|
42
|
+
def create
|
43
|
+
@comment = Comment.new(params[:comment])
|
44
|
+
|
45
|
+
respond_to do |format|
|
46
|
+
if @comment.save
|
47
|
+
flash[:notice] = 'Comment was successfully created.'
|
48
|
+
format.html { redirect_to(@comment) }
|
49
|
+
format.xml { render :xml => @comment, :status => :created, :location => @comment }
|
50
|
+
else
|
51
|
+
format.html { render :action => "new" }
|
52
|
+
format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# PUT /comments/1
|
58
|
+
# PUT /comments/1.xml
|
59
|
+
def update
|
60
|
+
@comment = Comment.find(params[:id])
|
61
|
+
|
62
|
+
respond_to do |format|
|
63
|
+
if @comment.update_attributes(params[:comment])
|
64
|
+
flash[:notice] = 'Comment was successfully updated.'
|
65
|
+
format.html { redirect_to(@comment) }
|
66
|
+
format.xml { head :ok }
|
67
|
+
else
|
68
|
+
format.html { render :action => "edit" }
|
69
|
+
format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# DELETE /comments/1
|
75
|
+
# DELETE /comments/1.xml
|
76
|
+
def destroy
|
77
|
+
@comment = Comment.find(params[:id])
|
78
|
+
@comment.destroy
|
79
|
+
|
80
|
+
respond_to do |format|
|
81
|
+
format.html { redirect_to(comments_url) }
|
82
|
+
format.xml { head :ok }
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
class PostsController < ApplicationController
|
2
|
+
# GET /posts
|
3
|
+
# GET /posts.xml
|
4
|
+
def index
|
5
|
+
@posts = Post.all
|
6
|
+
|
7
|
+
respond_to do |format|
|
8
|
+
format.html # index.html.erb
|
9
|
+
format.xml { render :xml => @posts }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /posts/1
|
14
|
+
# GET /posts/1.xml
|
15
|
+
def show
|
16
|
+
@post = Post.find(params[:id])
|
17
|
+
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # show.html.erb
|
20
|
+
format.xml { render :xml => @post }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /posts/new
|
25
|
+
# GET /posts/new.xml
|
26
|
+
def new
|
27
|
+
@post = Post.new
|
28
|
+
|
29
|
+
respond_to do |format|
|
30
|
+
format.html # new.html.erb
|
31
|
+
format.xml { render :xml => @post }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# GET /posts/1/edit
|
36
|
+
def edit
|
37
|
+
@post = Post.find(params[:id])
|
38
|
+
end
|
39
|
+
|
40
|
+
# POST /posts
|
41
|
+
# POST /posts.xml
|
42
|
+
def create
|
43
|
+
@post = Post.new(params[:post])
|
44
|
+
|
45
|
+
respond_to do |format|
|
46
|
+
if @post.save
|
47
|
+
flash[:notice] = 'Post was successfully created.'
|
48
|
+
format.html { redirect_to(@post) }
|
49
|
+
format.xml { render :xml => @post, :status => :created, :location => @post }
|
50
|
+
else
|
51
|
+
format.html { render :action => "new" }
|
52
|
+
format.xml { render :xml => @post.errors, :status => :unprocessable_entity }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# PUT /posts/1
|
58
|
+
# PUT /posts/1.xml
|
59
|
+
def update
|
60
|
+
@post = Post.find(params[:id])
|
61
|
+
|
62
|
+
respond_to do |format|
|
63
|
+
if @post.update_attributes(params[:post])
|
64
|
+
flash[:notice] = 'Post was successfully updated.'
|
65
|
+
format.html { redirect_to(@post) }
|
66
|
+
format.xml { head :ok }
|
67
|
+
else
|
68
|
+
format.html { render :action => "edit" }
|
69
|
+
format.xml { render :xml => @post.errors, :status => :unprocessable_entity }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# DELETE /posts/1
|
75
|
+
# DELETE /posts/1.xml
|
76
|
+
def destroy
|
77
|
+
@post = Post.find(params[:id])
|
78
|
+
@post.destroy
|
79
|
+
|
80
|
+
respond_to do |format|
|
81
|
+
format.html { redirect_to(posts_url) }
|
82
|
+
format.xml { head :ok }
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
class UsersController < ApplicationController
|
2
|
+
# GET /users
|
3
|
+
# GET /users.xml
|
4
|
+
def index
|
5
|
+
@users = User.all
|
6
|
+
|
7
|
+
respond_to do |format|
|
8
|
+
format.html # index.html.erb
|
9
|
+
format.xml { render :xml => @users }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /users/1
|
14
|
+
# GET /users/1.xml
|
15
|
+
def show
|
16
|
+
@user = User.find(params[:id])
|
17
|
+
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # show.html.erb
|
20
|
+
format.xml { render :xml => @user }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /users/new
|
25
|
+
# GET /users/new.xml
|
26
|
+
def new
|
27
|
+
@user = User.new
|
28
|
+
|
29
|
+
respond_to do |format|
|
30
|
+
format.html # new.html.erb
|
31
|
+
format.xml { render :xml => @user }
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# GET /users/1/edit
|
36
|
+
def edit
|
37
|
+
@user = User.find(params[:id])
|
38
|
+
end
|
39
|
+
|
40
|
+
# POST /users
|
41
|
+
# POST /users.xml
|
42
|
+
def create
|
43
|
+
@user = User.new(params[:user])
|
44
|
+
|
45
|
+
respond_to do |format|
|
46
|
+
if @user.save
|
47
|
+
flash[:notice] = 'User was successfully created.'
|
48
|
+
format.html { redirect_to(@user) }
|
49
|
+
format.xml { render :xml => @user, :status => :created, :location => @user }
|
50
|
+
else
|
51
|
+
format.html { render :action => "new" }
|
52
|
+
format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# PUT /users/1
|
58
|
+
# PUT /users/1.xml
|
59
|
+
def update
|
60
|
+
@user = User.find(params[:id])
|
61
|
+
|
62
|
+
respond_to do |format|
|
63
|
+
if @user.update_attributes(params[:user])
|
64
|
+
flash[:notice] = 'User was successfully updated.'
|
65
|
+
format.html { redirect_to(@user) }
|
66
|
+
format.xml { head :ok }
|
67
|
+
else
|
68
|
+
format.html { render :action => "edit" }
|
69
|
+
format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# DELETE /users/1
|
75
|
+
# DELETE /users/1.xml
|
76
|
+
def destroy
|
77
|
+
@user = User.find(params[:id])
|
78
|
+
@user.destroy
|
79
|
+
|
80
|
+
respond_to do |format|
|
81
|
+
format.html { redirect_to(users_url) }
|
82
|
+
format.xml { head :ok }
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<h1>Editing comment</h1>
|
2
|
+
|
3
|
+
<% form_for(@comment) do |f| %>
|
4
|
+
<%= f.error_messages %>
|
5
|
+
|
6
|
+
<p>
|
7
|
+
<%= f.label :post_id %><br />
|
8
|
+
<%= f.text_field :post_id %>
|
9
|
+
</p>
|
10
|
+
<p>
|
11
|
+
<%= f.label :title %><br />
|
12
|
+
<%= f.text_field :title %>
|
13
|
+
</p>
|
14
|
+
<p>
|
15
|
+
<%= f.label :body %><br />
|
16
|
+
<%= f.text_area :body %>
|
17
|
+
</p>
|
18
|
+
<p>
|
19
|
+
<%= f.submit 'Update' %>
|
20
|
+
</p>
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
<%= link_to 'Show', @comment %> |
|
24
|
+
<%= link_to 'Back', comments_path %>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<h1>Listing comments</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
<th>Post</th>
|
6
|
+
<th>Title</th>
|
7
|
+
<th>Body</th>
|
8
|
+
</tr>
|
9
|
+
|
10
|
+
<% @comments.each do |comment| %>
|
11
|
+
<tr>
|
12
|
+
<td><%=h comment.post_id %></td>
|
13
|
+
<td><%=h comment.title %></td>
|
14
|
+
<td><%=h comment.body %></td>
|
15
|
+
<td><%= link_to 'Show', comment %></td>
|
16
|
+
<td><%= link_to 'Edit', edit_comment_path(comment) %></td>
|
17
|
+
<td><%= link_to 'Destroy', comment, :confirm => 'Are you sure?', :method => :delete %></td>
|
18
|
+
</tr>
|
19
|
+
<% end %>
|
20
|
+
</table>
|
21
|
+
|
22
|
+
<br />
|
23
|
+
|
24
|
+
<%= link_to 'New comment', new_comment_path %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<h1>New comment</h1>
|
2
|
+
|
3
|
+
<% form_for(@comment) do |f| %>
|
4
|
+
<%= f.error_messages %>
|
5
|
+
|
6
|
+
<p>
|
7
|
+
<%= f.label :post_id %><br />
|
8
|
+
<%= f.text_field :post_id %>
|
9
|
+
</p>
|
10
|
+
<p>
|
11
|
+
<%= f.label :title %><br />
|
12
|
+
<%= f.text_field :title %>
|
13
|
+
</p>
|
14
|
+
<p>
|
15
|
+
<%= f.label :body %><br />
|
16
|
+
<%= f.text_area :body %>
|
17
|
+
</p>
|
18
|
+
<p>
|
19
|
+
<%= f.submit 'Create' %>
|
20
|
+
</p>
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
<%= link_to 'Back', comments_path %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<p>
|
2
|
+
<b>Post:</b>
|
3
|
+
<%=h @comment.post_id %>
|
4
|
+
</p>
|
5
|
+
|
6
|
+
<p>
|
7
|
+
<b>Title:</b>
|
8
|
+
<%=h @comment.title %>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<b>Body:</b>
|
13
|
+
<%=h @comment.body %>
|
14
|
+
</p>
|
15
|
+
|
16
|
+
|
17
|
+
<%= link_to 'Edit', edit_comment_path(@comment) %> |
|
18
|
+
<%= link_to 'Back', comments_path %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
7
|
+
<title>Comments: <%= controller.action_name %></title>
|
8
|
+
<%= stylesheet_link_tag 'scaffold' %>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
|
12
|
+
<p style="color: green"><%= flash[:notice] %></p>
|
13
|
+
|
14
|
+
<%= yield %>
|
15
|
+
|
16
|
+
</body>
|
17
|
+
</html>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
7
|
+
<title>Posts: <%= controller.action_name %></title>
|
8
|
+
<%= stylesheet_link_tag 'scaffold' %>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
|
12
|
+
<p style="color: green"><%= flash[:notice] %></p>
|
13
|
+
|
14
|
+
<%= yield %>
|
15
|
+
|
16
|
+
</body>
|
17
|
+
</html>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
7
|
+
<title>Users: <%= controller.action_name %></title>
|
8
|
+
<%= stylesheet_link_tag 'scaffold' %>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
|
12
|
+
<p style="color: green"><%= flash[:notice] %></p>
|
13
|
+
|
14
|
+
<%= yield %>
|
15
|
+
|
16
|
+
</body>
|
17
|
+
</html>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<h1>Editing post</h1>
|
2
|
+
|
3
|
+
<% form_for(@post) do |f| %>
|
4
|
+
<%= f.error_messages %>
|
5
|
+
|
6
|
+
<p>
|
7
|
+
<%= f.label :user_id %><br />
|
8
|
+
<%= f.text_field :user_id %>
|
9
|
+
</p>
|
10
|
+
<p>
|
11
|
+
<%= f.label :title %><br />
|
12
|
+
<%= f.text_field :title %>
|
13
|
+
</p>
|
14
|
+
<p>
|
15
|
+
<%= f.label :body %><br />
|
16
|
+
<%= f.text_area :body %>
|
17
|
+
</p>
|
18
|
+
<p>
|
19
|
+
<%= f.submit 'Update' %>
|
20
|
+
</p>
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
<%= link_to 'Show', @post %> |
|
24
|
+
<%= link_to 'Back', posts_path %>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<h1>Listing posts</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
<th>User</th>
|
6
|
+
<th>Title</th>
|
7
|
+
<th>Body</th>
|
8
|
+
</tr>
|
9
|
+
|
10
|
+
<% @posts.each do |post| %>
|
11
|
+
<tr>
|
12
|
+
<td><%=h post.user_id %></td>
|
13
|
+
<td><%=h post.title %></td>
|
14
|
+
<td><%=h post.body %></td>
|
15
|
+
<td><%= link_to 'Show', post %></td>
|
16
|
+
<td><%= link_to 'Edit', edit_post_path(post) %></td>
|
17
|
+
<td><%= link_to 'Destroy', post, :confirm => 'Are you sure?', :method => :delete %></td>
|
18
|
+
</tr>
|
19
|
+
<% end %>
|
20
|
+
</table>
|
21
|
+
|
22
|
+
<br />
|
23
|
+
|
24
|
+
<%= link_to 'New post', new_post_path %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<h1>New post</h1>
|
2
|
+
|
3
|
+
<% form_for(@post) do |f| %>
|
4
|
+
<%= f.error_messages %>
|
5
|
+
|
6
|
+
<p>
|
7
|
+
<%= f.label :user_id %><br />
|
8
|
+
<%= f.text_field :user_id %>
|
9
|
+
</p>
|
10
|
+
<p>
|
11
|
+
<%= f.label :title %><br />
|
12
|
+
<%= f.text_field :title %>
|
13
|
+
</p>
|
14
|
+
<p>
|
15
|
+
<%= f.label :body %><br />
|
16
|
+
<%= f.text_area :body %>
|
17
|
+
</p>
|
18
|
+
<p>
|
19
|
+
<%= f.submit 'Create' %>
|
20
|
+
</p>
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
<%= link_to 'Back', posts_path %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<p>
|
2
|
+
<b>User:</b>
|
3
|
+
<%=h @post.user_id %>
|
4
|
+
</p>
|
5
|
+
|
6
|
+
<p>
|
7
|
+
<b>Title:</b>
|
8
|
+
<%=h @post.title %>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<b>Body:</b>
|
13
|
+
<%=h @post.body %>
|
14
|
+
</p>
|
15
|
+
|
16
|
+
|
17
|
+
<%= link_to 'Edit', edit_post_path(@post) %> |
|
18
|
+
<%= link_to 'Back', posts_path %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<h1>Editing user</h1>
|
2
|
+
|
3
|
+
<% form_for(@user) do |f| %>
|
4
|
+
<%= f.error_messages %>
|
5
|
+
|
6
|
+
<p>
|
7
|
+
<%= f.label :name %><br />
|
8
|
+
<%= f.text_field :name %>
|
9
|
+
</p>
|
10
|
+
<p>
|
11
|
+
<%= f.submit 'Update' %>
|
12
|
+
</p>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<%= link_to 'Show', @user %> |
|
16
|
+
<%= link_to 'Back', users_path %>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<h1>Listing users</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
<th>Name</th>
|
6
|
+
</tr>
|
7
|
+
|
8
|
+
<% @users.each do |user| %>
|
9
|
+
<tr>
|
10
|
+
<td><%=h user.name %></td>
|
11
|
+
<td><%= link_to 'Show', user %></td>
|
12
|
+
<td><%= link_to 'Edit', edit_user_path(user) %></td>
|
13
|
+
<td><%= link_to 'Destroy', user, :confirm => 'Are you sure?', :method => :delete %></td>
|
14
|
+
</tr>
|
15
|
+
<% end %>
|
16
|
+
</table>
|
17
|
+
|
18
|
+
<br />
|
19
|
+
|
20
|
+
<%= link_to 'New user', new_user_path %>
|