質問編集履歴
1
indexのviewを追記しました!お願いします。
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,6 +14,8 @@
|
|
14
14
|
|
15
15
|
### 発生している問題・エラーメッセージ
|
16
16
|
|
17
|
+
|
18
|
+
|
17
19
|
NoMethodError in Articles#show
|
18
20
|
|
19
21
|
Showing /Users/yukahayuusatoru/projects/b_blog/app/views/articles/show.html.erb where line #8 raised:
|
@@ -24,10 +26,6 @@
|
|
24
26
|
|
25
27
|
|
26
28
|
|
27
|
-
エラーメッセージ
|
28
|
-
|
29
|
-
```
|
30
|
-
|
31
29
|
|
32
30
|
|
33
31
|
|
@@ -36,7 +34,7 @@
|
|
36
34
|
|
37
35
|
|
38
36
|
|
39
|
-
|
37
|
+
```class ArticlesController < ApplicationController
|
40
38
|
|
41
39
|
|
42
40
|
|
@@ -96,13 +94,15 @@
|
|
96
94
|
|
97
95
|
end
|
98
96
|
|
97
|
+
```
|
98
|
+
|
99
99
|
|
100
100
|
|
101
101
|
### app/views/articles/show.html.erb
|
102
102
|
|
103
|
-
|
103
|
+
```
|
104
|
-
|
104
|
+
|
105
|
-
|
105
|
+
<div class="header-title">
|
106
106
|
|
107
107
|
<%= link_to 'B-blog', root_path, class:"form-header-text" %>
|
108
108
|
|
@@ -156,6 +156,84 @@
|
|
156
156
|
|
157
157
|
|
158
158
|
|
159
|
+
```
|
160
|
+
|
161
|
+
### app/views/articles/index.html.erb
|
162
|
+
|
163
|
+
```
|
164
|
+
|
165
|
+
<div class="title">
|
166
|
+
|
167
|
+
<ul class="top-botton">
|
168
|
+
|
169
|
+
<% if user_signed_in? %>
|
170
|
+
|
171
|
+
<li><%= link_to current_user.name, "#", class:"user-name" %></li>
|
172
|
+
|
173
|
+
<li><%= link_to 'New Article', new_article_path, class:"new-article" %></li>
|
174
|
+
|
175
|
+
<%# <li><%= link_to 'ログアウト', destroy_user_session_path, method: :delete, class:"logout"%></li>
|
176
|
+
|
177
|
+
<% else %>
|
178
|
+
|
179
|
+
<li><%= link_to 'ログイン', new_user_session_path, class: "login" %></li>
|
180
|
+
|
181
|
+
<li><%= link_to '新規登録', new_user_registration_path, class: "sign-up" %>
|
182
|
+
|
183
|
+
<% end %>
|
184
|
+
|
185
|
+
</ul>
|
186
|
+
|
187
|
+
<div class="title-content">B-blog</div>
|
188
|
+
|
189
|
+
</div>
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
<div class="main">
|
194
|
+
|
195
|
+
<% @articles.each do |article| %>
|
196
|
+
|
197
|
+
<li class="list">
|
198
|
+
|
199
|
+
<%= link_to article_path(article.id), class:"article-name", method: :get do %>
|
200
|
+
|
201
|
+
<div class="article-img-content">
|
202
|
+
|
203
|
+
<%= image_tag article.image, class:"article-img"%>
|
204
|
+
|
205
|
+
</div>
|
206
|
+
|
207
|
+
<div class="article-info">
|
208
|
+
|
209
|
+
<h1 class="article-name">
|
210
|
+
|
211
|
+
<%= article.title%>
|
212
|
+
|
213
|
+
</h1>
|
214
|
+
|
215
|
+
<h1 class="article-name">
|
216
|
+
|
217
|
+
<%= article.category.name%>
|
218
|
+
|
219
|
+
</h1>
|
220
|
+
|
221
|
+
</div>
|
222
|
+
|
223
|
+
<% end %>
|
224
|
+
|
225
|
+
</li>
|
226
|
+
|
227
|
+
<% end %>
|
228
|
+
|
229
|
+
</div>
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
```
|
234
|
+
|
235
|
+
追記でindex.html.erbのビューファイルも載せます。
|
236
|
+
|
159
237
|
|
160
238
|
|
161
239
|
|