teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

一部見出しの変更

2016/01/24 05:28

投稿

Tomoaki_Fukuda
Tomoaki_Fukuda

スコア75

title CHANGED
File without changes
body CHANGED
@@ -96,9 +96,9 @@
96
96
 
97
97
  ```
98
98
 
99
- ###追加情報
99
+ ###追加情報「index.html.erb」
100
100
 
101
- ```index.html.erb
101
+ ```
102
102
  <p id="notice"><%= notice %></p>
103
103
 
104
104
  <h1>Listing Comments</h1>

1

deleteを呼び出すviewである「index\.html\.erb」を追記しました。

2016/01/24 05:28

投稿

Tomoaki_Fukuda
Tomoaki_Fukuda

スコア75

title CHANGED
File without changes
body CHANGED
@@ -96,4 +96,39 @@
96
96
 
97
97
  ```
98
98
 
99
+ ###追加情報
100
+
101
+ ```index.html.erb
102
+ <p id="notice"><%= notice %></p>
103
+
104
+ <h1>Listing Comments</h1>
105
+
106
+ <table>
107
+ <thead>
108
+ <tr>
99
- ###補足情報(言語/FW/ツール等のバージョンなど)
109
+ <th>User</th>
110
+ <th>Photo</th>
111
+ <th>Body</th>
112
+ <th colspan="3"></th>
113
+ </tr>
114
+ </thead>
115
+
116
+ <tbody>
117
+ <% @comments.each do |comment| %>
118
+ <tr>
119
+ <td><%= comment.user_id %></td>
120
+ <td><%= comment.photo_id %></td>
121
+ <td><%= comment.body %></td>
122
+ <td><%= link_to 'Show', comment %></td>
123
+ <td><%= link_to 'Edit', edit_comment_path(comment) %></td>
124
+ <td><%= link_to 'Destroy', comment, method: :delete, data: { confirm: 'Are you sure?' } %></td>
125
+ </tr>
126
+ <% end %>
127
+ </tbody>
128
+ </table>
129
+
130
+ <br>
131
+
132
+ <%= link_to 'New Comment', new_comment_path %>
133
+
134
+ ```