質問編集履歴
1
viewページの追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -167,3 +167,113 @@
|
|
167
167
|
end
|
168
168
|
|
169
169
|
```
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
viewページを追記しておきます。
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
私の前回の質問と少しかぶりますが、
|
178
|
+
|
179
|
+
showとindexはほぼ中身が同じなのでパーシャルを使いまわしたいです。
|
180
|
+
|
181
|
+
しかしshowページのrenderメソッドで、collectionに渡す@souvenirが認識されず、パーシャルを使えていません。
|
182
|
+
|
183
|
+
```ShowView
|
184
|
+
|
185
|
+
<div class = "row souvenir_box">
|
186
|
+
|
187
|
+
<div class = "souvenir_name col-sm-12"><%= @souvenir.name%></div>
|
188
|
+
|
189
|
+
<div class = "col-sm-8">
|
190
|
+
|
191
|
+
<div class="row">
|
192
|
+
|
193
|
+
<div class = "souvenir_spot col-sm-12 souvenir_text-items "><%= @souvenir.spot%></div>
|
194
|
+
|
195
|
+
<div class = "souvenir_price col-sm-12 souvenir_text-items"><%= @souvenir.price%></div>
|
196
|
+
|
197
|
+
<div class = "souvenir_genre col-sm-12 souvenir_text-items"><%= @souvenir.genre%></div>
|
198
|
+
|
199
|
+
</div>
|
200
|
+
|
201
|
+
</div>
|
202
|
+
|
203
|
+
<div class = "col-sm-4">
|
204
|
+
|
205
|
+
<% if @souvenir.picture? %>
|
206
|
+
|
207
|
+
<%= image_tag @souvenir.picture.thumb.url %>
|
208
|
+
|
209
|
+
<% else %>
|
210
|
+
|
211
|
+
<p>noimages</p>
|
212
|
+
|
213
|
+
<% end %>
|
214
|
+
|
215
|
+
</div>
|
216
|
+
|
217
|
+
<div class = "col-sm-12"><%= @souvenir.comment%></div>
|
218
|
+
|
219
|
+
</div>
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
```
|
226
|
+
|
227
|
+
```IndexView
|
228
|
+
|
229
|
+
<%= will_paginate @souvenirs %>
|
230
|
+
|
231
|
+
<%= render partial:"souvenir", collection: @souvenirs %>
|
232
|
+
|
233
|
+
<%= will_paginate @souvenirs %>
|
234
|
+
|
235
|
+
```
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
```Partial
|
240
|
+
|
241
|
+
<%= link_to souvenir_path(@souvenirs) do %>
|
242
|
+
|
243
|
+
<div class = "row souvenir_box">
|
244
|
+
|
245
|
+
<div class = "souvenir_name col-sm-12"><%= souvenir.name%></div>
|
246
|
+
|
247
|
+
<div class = "col-sm-8">
|
248
|
+
|
249
|
+
<div class="row">
|
250
|
+
|
251
|
+
<div class = "souvenir_spot col-sm-12 souvenir_text-items "><%= souvenir.spot%></div>
|
252
|
+
|
253
|
+
<div class = "souvenir_price col-sm-12 souvenir_text-items"><%= souvenir.price%></div>
|
254
|
+
|
255
|
+
<div class = "souvenir_genre col-sm-12 souvenir_text-items"><%= souvenir.genre%></div>
|
256
|
+
|
257
|
+
</div>
|
258
|
+
|
259
|
+
</div>
|
260
|
+
|
261
|
+
<div class = "col-sm-4">
|
262
|
+
|
263
|
+
<% if souvenir.picture? %>
|
264
|
+
|
265
|
+
<%= image_tag souvenir.picture.thumb.url %>
|
266
|
+
|
267
|
+
<% else %>
|
268
|
+
|
269
|
+
<p>noimages</p>
|
270
|
+
|
271
|
+
<% end %>
|
272
|
+
|
273
|
+
</div>
|
274
|
+
|
275
|
+
</div>
|
276
|
+
|
277
|
+
<% end %>
|
278
|
+
|
279
|
+
```
|