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

質問編集履歴

2

エラーメッセージの表示

2020/11/08 08:37

投稿

toratail
toratail

スコア12

title CHANGED
File without changes
body CHANGED
@@ -7,7 +7,15 @@
7
7
 
8
8
  よろしくお願いします。
9
9
 
10
+
10
11
  ```
12
+ エラーメッセージ
13
+
14
+ Routing Error
15
+ No route matches [GET] "/items/ItemOrder/order"
16
+
17
+ ```
18
+ ```
11
19
  order/index
12
20
 
13
21
  <div class='buy-btn'>

1

コードの書き直し

2020/11/08 08:36

投稿

toratail
toratail

スコア12

title CHANGED
File without changes
body CHANGED
@@ -7,7 +7,9 @@
7
7
 
8
8
  よろしくお願いします。
9
9
 
10
+ ```
10
- ```order/index
11
+ order/index
12
+
11
13
  <div class='buy-btn'>
12
14
  <%# <%= f.submit "購入" ,class:"buy-red-btn" %>
13
15
  <%= link_to '購入', order_item_path(), class: "buy-red-btn" %>
@@ -15,7 +17,9 @@
15
17
 
16
18
  ```
17
19
 
20
+ ```
18
- ```order.controller
21
+ order.controller
22
+
19
23
  class OrdersController < ApplicationController
20
24
  before_action :authenticate_user!, only: :index
21
25
  before_action :set_order, only: [:index, :create]
@@ -105,7 +109,9 @@
105
109
  end
106
110
  ```
107
111
 
112
+ ```
108
- ```routes.rb
113
+ routes.rb
114
+
109
115
  Rails.application.routes.draw do
110
116
  get 'cards/new'
111
117
  get 'users/show'
@@ -130,7 +136,9 @@
130
136
 
131
137
  ```
132
138
 
139
+ ```
133
- ```order.model
140
+ order.model
141
+
134
142
  class Order < ApplicationRecord
135
143
  belongs_to :user
136
144
  belongs_to :item