質問編集履歴
6
詳細
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,11 +2,21 @@
|
|
2
2
|
|
3
3
|
初めて質問させていただきます。
|
4
4
|
|
5
|
+
|
6
|
+
|
5
7
|
railsでポイント管理サービスをつくっています。
|
6
8
|
|
7
9
|
ポイント特典を作成する機能を実装中にエラーが発生しました。
|
8
10
|
|
11
|
+
|
12
|
+
|
13
|
+
親要素(card_list)のindexページから子要素(point_list)のnewページに飛ばすpathでエラーが発生しています。
|
14
|
+
|
15
|
+
エラー文から親要素のidが取得できれば解決できると考えています。
|
16
|
+
|
17
|
+
|
18
|
+
|
9
|
-
|
19
|
+
なので、親要素(card_list)のidをpoint_listsコントローラーで子要素(point_list)へ渡せるようにしたいです。
|
10
20
|
|
11
21
|
|
12
22
|
|
5
index
test
CHANGED
File without changes
|
test
CHANGED
@@ -338,7 +338,7 @@
|
|
338
338
|
|
339
339
|
```
|
340
340
|
|
341
|
-
views/card_lists/index.haml
|
341
|
+
views/card_lists/index.html.haml
|
342
342
|
|
343
343
|
|
344
344
|
|
4
index
test
CHANGED
File without changes
|
test
CHANGED
@@ -334,4 +334,72 @@
|
|
334
334
|
|
335
335
|
```
|
336
336
|
|
337
|
+
|
338
|
+
|
339
|
+
```
|
340
|
+
|
341
|
+
views/card_lists/index.haml
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
=render "layouts/header"
|
346
|
+
|
347
|
+
.card_list-index-contents
|
348
|
+
|
349
|
+
.index-contents
|
350
|
+
|
351
|
+
.index-contents__upper
|
352
|
+
|
353
|
+
.index-contents__upper__image
|
354
|
+
|
355
|
+
= image_tag @card_list.image, size: "166x150"
|
356
|
+
|
357
|
+
%h2.index-contents__upper__name
|
358
|
+
|
359
|
+
=@card_list.name
|
360
|
+
|
361
|
+
%ul.index-contents__upper__info
|
362
|
+
|
363
|
+
%li.index-contents__upper__address
|
364
|
+
|
365
|
+
="住所: #{@card_list.address}"
|
366
|
+
|
367
|
+
%li.index-contents__upper__openig
|
368
|
+
|
369
|
+
="営業時間: #{@card_list.opening_hours.strftime('%H:%M')} 〜 #{@card_list.closing_hours.strftime('%H:%M')}"
|
370
|
+
|
371
|
+
%li.index-contents__upper_tel
|
372
|
+
|
373
|
+
="TEL: #{@card_list.phone_num}"
|
374
|
+
|
375
|
+
%li.index-contents__upper__url
|
376
|
+
|
377
|
+
="URL:"
|
378
|
+
|
379
|
+
=auto_link(@card_list.url, html: { target: '_blank' })
|
380
|
+
|
381
|
+
.index-contents__upper__btn
|
382
|
+
|
383
|
+
=link_to "編集", "#", class: "index-contents__upper__btn__edit btn btn-warning"
|
384
|
+
|
385
|
+
=link_to "削除", "#", class: "index-contents__upper__btn__delete btn btn-danger"
|
386
|
+
|
387
|
+
.index-contents__middle
|
388
|
+
|
389
|
+
%h2.index-contents__middle__points
|
390
|
+
|
391
|
+
ポイント特典
|
392
|
+
|
393
|
+
=link_to "追加", "#", class: "index-contents__middle__points__add btn btn-success"
|
394
|
+
|
395
|
+
%h2.index-contents__middle__coupons
|
396
|
+
|
397
|
+
クーポン
|
398
|
+
|
399
|
+
=link_to "追加", "#", class: "index-contents__middle__coupons__add btn btn-success"
|
400
|
+
|
401
|
+
```
|
402
|
+
|
403
|
+
|
404
|
+
|
337
405
|
ここにより詳細な情報を記載してください。
|
3
routes
test
CHANGED
File without changes
|
test
CHANGED
@@ -270,6 +270,10 @@
|
|
270
270
|
|
271
271
|
```
|
272
272
|
|
273
|
+
routes.rb
|
274
|
+
|
275
|
+
|
276
|
+
|
273
277
|
Rails.application.routes.draw do
|
274
278
|
|
275
279
|
root "introduction#home"
|
2
ルーティング追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -268,6 +268,66 @@
|
|
268
268
|
|
269
269
|
```
|
270
270
|
|
271
|
-
|
271
|
+
```
|
272
|
+
|
273
|
+
Rails.application.routes.draw do
|
274
|
+
|
275
|
+
root "introduction#home"
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
# 消費者ユーザー
|
280
|
+
|
281
|
+
namespace :users, only: [:new, :create] do
|
282
|
+
|
283
|
+
get "/login", to: "sessions#new"
|
284
|
+
|
285
|
+
post "/login", to: "sessions#create"
|
286
|
+
|
287
|
+
delete "/logout", to: "sessions#destroy"
|
288
|
+
|
289
|
+
end
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
resources :users
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
# 管理者ユーザー
|
298
|
+
|
299
|
+
namespace :admins do
|
300
|
+
|
301
|
+
get "/login", to: "sessions#new"
|
302
|
+
|
303
|
+
post "/login", to: "sessions#create"
|
304
|
+
|
305
|
+
delete "/logout", to: "sessions#destroy"
|
306
|
+
|
307
|
+
end
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
resources :admins, only: [:new, :create] do
|
312
|
+
|
313
|
+
resources :card_lists, only: [:index, :new, :create] do
|
314
|
+
|
315
|
+
resources :point_lists, only: [:new, :create]
|
316
|
+
|
317
|
+
resources :coupon_lists, only: [:new, :create]
|
318
|
+
|
319
|
+
end
|
320
|
+
|
321
|
+
end
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
resources :admins
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
end
|
330
|
+
|
331
|
+
```
|
272
332
|
|
273
333
|
ここにより詳細な情報を記載してください。
|
1
エラーメッセージ表示
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,13 +14,15 @@
|
|
14
14
|
|
15
15
|
point_listの親要素であるcard_listのidが空であると言われています。
|
16
16
|
|
17
|
-
|
17
|
+
|
18
18
|
|
19
19
|
エラーメッセージ
|
20
20
|
|
21
21
|
No route matches {:action=>"new", :admin_id=>#<CardList id: 2, admin_id: 2, name: "カレー", address: "大阪", opening_hours: "2000-01-01 11:30:00", closing_hours: "2000-01-01 23:00:00", phone_num: "0000000000", url: "https://www.ashoka-jp.com/", created_at: "2020-03-14 06:52:09", updated_at: "2020-03-14 06:52:09">, :controller=>"point_lists"}, missing required keys: [:card_list_id]
|
22
22
|
|
23
|
-
|
23
|
+
|
24
|
+
|
25
|
+
|
24
26
|
|
25
27
|
|
26
28
|
|