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

質問編集履歴

10

ER図訂正

2020/01/15 00:23

投稿

nissyan
nissyan

スコア15

title CHANGED
File without changes
body CHANGED
@@ -141,7 +141,7 @@
141
141
  ```
142
142
  --------------------------------------------------------------------------
143
143
 
144
- ![Model ER図改正](3787861437a3d620e25e2a22b6356e18.png)
144
+ ![Model ER図改正]![イメージ説明](10b25a872a3fcb5d103c05ae88a44e33.png)
145
145
 
146
146
  カートのモデルコード
147
147
  ```ruby

9

ER図改正

2020/01/15 00:23

投稿

nissyan
nissyan

スコア15

title CHANGED
File without changes
body CHANGED
@@ -141,7 +141,7 @@
141
141
  ```
142
142
  --------------------------------------------------------------------------
143
143
 
144
- ![model ER図](5a80c9978d0b6437424095b58b62462a.png)
144
+ ![Model ER図改正](3787861437a3d620e25e2a22b6356e18.png)
145
145
 
146
146
  カートのモデルコード
147
147
  ```ruby

8

teisei

2020/01/14 14:40

投稿

nissyan
nissyan

スコア15

title CHANGED
File without changes
body CHANGED
@@ -1,8 +1,8 @@
1
1
  Ruby on Railsでショッピングカート機能を実装しています。
2
- 商品一覧画面から、商品の個数を選択してcart_itemテーブルに保存したい状況です。
2
+ 商品一覧画面から、商品の個数を選択してcartテーブルに保存したい状況です。
3
- cart_itemテーブルはsessionで仮に商品を保存するためのテーブルとなってます。
3
+ cartテーブルはsessionで仮に商品を保存するためのテーブルとなってます。
4
4
 
5
- そして商品一覧indexのコントローラーで、cart_item.newを記述して、cart_itemのコントローラーで
5
+ そして商品一覧indexのコントローラーで、cart.newを記述して、cartのコントローラーで
6
6
  createメソッドに飛ばしています。
7
7
 
8
8
  環境:

7

cart_itemをcartに変更し、前コードを修正

2020/01/14 12:09

投稿

nissyan
nissyan

スコア15

title CHANGED
File without changes
body CHANGED
@@ -16,13 +16,14 @@
16
16
  class BoxlunchesController < ApplicationController
17
17
  def index
18
18
  @boxlunches = Boxlunch.all
19
- @cart_item = CartItem.new
19
+ @cart = Cart.new
20
20
  end
21
21
 
22
22
  def show
23
23
  end
24
24
  end
25
25
 
26
+
26
27
  ```
27
28
  -------------------------------------------------
28
29
  課題:
@@ -33,9 +34,14 @@
33
34
  ```Ruby
34
35
  index.html.haml
35
36
 
37
+ = render 'layouts/header'
38
+ = render "./template/menu_selections"
39
+ .menu-container
40
+ %h2 Boxlunch Menu
36
- .menu-contents
41
+ .menu-contents
37
42
  - @boxlunches.each do |boxlunch|
43
+     #cart_index_pathでcartのcreateに飛びます
38
- = form_for @cart_item, url: cart_items_path(boxlunch_id: boxlunch.id), method: :post do |f|
44
+ = form_for @cart, url: cart_index_path(boxlunch_id: boxlunch.id), method: :post do |f|
39
45
  .menu-package
40
46
  .menu-image
41
47
  = link_to "boxlunch/#{boxlunch.id}" do
@@ -51,6 +57,7 @@
51
57
  %label
52
58
  =f.select :boxlunch_quantity, options_for_select(1..10), include_blank: '0'
53
59
  =f.submit "カートの中に入れる"
60
+ = render 'layouts/footer'
54
61
  ```
55
62
 
56
63
 
@@ -63,42 +70,41 @@
63
70
  ターミナルでの記載になります。
64
71
  ```ruby
65
72
  ターミナル
66
- Started POST "/cart_items?boxlunch_id=2" for ::1 at 2020-01-12 23:54:40 +0900
67
- Processing by CartItemsController#create as HTML
68
- Parameters: {"utf8"=>"✓", "authenticity_token"=>"NOg0zYOHm2sCIqeRmMCdz+pUbAfOax99Uy2cOnp4/CO4WwgRUsFUMg2RA0EYXS9VBHrBQ1HZAuQJsqaOGDtV+Q==", "cart_item"=>{"boxlunch_quantity"=>"2"}, "commit"=>"カートの中に入れる", "boxlunch_id"=>"2"}
69
- Order Load (0.9ms) SELECT "orders".* FROM "orders" WHERE "orders"."id" IS NULL LIMIT $1 [["LIMIT", 1]]
73
+ Started POST "/cart?boxlunch_id=1" for ::1 at 2020-01-13 23:49:36 +0900
74
+ Processing by CartController#create as HTML
75
+ Parameters: {"utf8"=>"✓", "authenticity_token"=>"O5g+me6pcK+uueZYWtdRBmkFdj+TzXqkyZRyw+q5KvkcqQ3wGLzM05qi79LfoOL9vd7aI54B78hSBNdXYOML2A==", "cart"=>{"boxlunch_quantity"=>"1"}, "commit"=>"カートの中に入れる", "boxlunch_id"=>"1"}
76
+ Order Load (2.0ms) SELECT "orders".* FROM "orders" WHERE "orders"."id" IS NULL LIMIT $1 [["LIMIT", 1]]
70
77
  ↳ app/controllers/application_controller.rb:16
71
- (0.2ms) BEGIN
78
+ (0.8ms) BEGIN
72
79
  ↳ app/controllers/application_controller.rb:17
73
- (0.4ms) ROLLBACK
80
+ (1.1ms) ROLLBACK
74
81
  ↳ app/controllers/application_controller.rb:17
75
- Boxlunch Load (1.0ms) SELECT "boxlunches".* FROM "boxlunches" WHERE "boxlunches"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]]
82
+ Boxlunch Load (0.7ms) SELECT "boxlunches".* FROM "boxlunches" WHERE "boxlunches"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
76
- ↳ app/controllers/cart_items_controller.rb:5
83
+ ↳ app/controllers/cart_controller.rb:4
77
- Order Load (0.3ms) SELECT "orders".* FROM "orders" WHERE "orders"."id" IS NULL LIMIT $1 [["LIMIT", 1]]
84
+ Order Load (1.6ms) SELECT "orders".* FROM "orders" WHERE "orders"."id" IS NULL LIMIT $1 [["LIMIT", 1]]
78
85
  ↳ app/controllers/application_controller.rb:16
79
- (0.2ms) BEGIN
86
+ (1.8ms) BEGIN
80
87
  ↳ app/controllers/application_controller.rb:17
81
- (0.1ms) ROLLBACK
88
+ (0.4ms) ROLLBACK
82
89
  ↳ app/controllers/application_controller.rb:17
83
- (0.2ms) BEGIN
84
- ↳ app/controllers/cart_items_controller.rb:7
85
- CartItem Create (0.9ms) INSERT INTO "cart_items" ("boxlunch_id", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["boxlunch_id", 2], ["created_at", "2020-01-12 14:54:40.381901"], ["updated_at", "2020-01-12 14:54:40.381901"]]
86
- ↳ app/controllers/cart_items_controller.rb:7
87
- (0.5ms) COMMIT
88
- ↳ app/controllers/cart_items_controller.rb:7
89
- User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", 1], ["LIMIT", 1]]
90
- ↳ app/controllers/cart_items_controller.rb:8
91
- Redirected to http://localhost:3000/cart_items/1
92
- Completed 302 Found in 33ms (ActiveRecord: 5.3ms)
90
+ (1.0ms) BEGIN
91
+ ↳ app/controllers/cart_controller.rb:6
92
+ Cart Create (0.5ms) INSERT INTO "carts" ("boxlunch_id", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["boxlunch_id", 1], ["created_at", "2020-01-13 14:49:36.819147"], ["updated_at", "2020-01-13 14:49:36.819147"]]
93
+ ↳ app/controllers/cart_controller.rb:6
94
+ (1.9ms) COMMIT
95
+ ↳ app/controllers/cart_controller.rb:6
96
+ User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", 1], ["LIMIT", 1]]
97
+ ↳ app/controllers/cart_controller.rb:7
98
+ Redirected to http://localhost:3000/cart/1
99
+ Completed 302 Found in 46ms (ActiveRecord: 12.1ms)
93
100
 
94
101
 
95
- Started GET "/cart_items/1" for ::1 at 2020-01-12 23:54:40 +0900
102
+ Started GET "/cart/1" for ::1 at 2020-01-13 23:49:36 +0900
96
- Processing by CartItemsController#show as HTML
103
+ Processing by CartController#show as HTML
97
104
  Parameters: {"id"=>"1"}
98
- Rendering cart_items/show.html.haml within layouts/application
105
+ Rendering cart/show.html.haml within layouts/application
99
- Rendered cart_items/show.html.haml within layouts/application (1.6ms)
106
+ Rendered cart/show.html.haml within layouts/application (1.9ms)
100
- Completed 200 OK in 72ms (Views: 68.7ms | ActiveRecord: 0.0ms)
107
+ Completed 200 OK in 63ms (Views: 60.4ms | ActiveRecord: 0.0ms)
101
-
102
108
  ```
103
109
 
104
110
 
@@ -133,57 +139,56 @@
133
139
  end
134
140
 
135
141
  ```
136
-
137
142
  --------------------------------------------------------------------------
138
143
 
144
+ ![model ER図](5a80c9978d0b6437424095b58b62462a.png)
145
+
139
- カートアイテムのモデルコード
146
+ カートのモデルコード
140
147
  ```ruby
141
- class CartItem < ApplicationRecord
148
+ class Cart < ApplicationRecord
142
149
  belongs_to :order
143
150
  has_many :boxlunches
144
151
 
145
152
 
146
153
  def add_boxlunch(boxlunch_id)
147
- cart_items.find_or_initialize_by(boxlunch_id: boxlunch_id)
154
+ cart.find_or_initialize_by(boxlunch_id: boxlunch_id)
148
- end
155
+ end
149
156
 
150
- def add_single_menu(single_menu_id)
157
+ def add_single_menu(single_menu_id)
151
- cart_items.find_or_initialize_by(single_menu_id: single_menu_id)
158
+ cart.find_or_initialize_by(single_menu_id: single_menu_id)
152
- end
159
+ end
153
160
  end
154
161
  ```
155
162
 
156
163
 
164
+
157
165
  -------------------------------------------------------------
158
166
 
159
- カートアイテムのコントローラーのコード
167
+ カートのコントローラーのコード
160
168
  ```ruby
161
- class CartItemsController < ApplicationController
169
+ class CartController < ApplicationController
162
-
163
- def create
170
+ def create
164
- cart = current_cart
171
+ cart = current_cart
165
- boxlunch = Boxlunch.find(params[:boxlunch_id])
172
+ boxlunch = Boxlunch.find(params[:boxlunch_id])
166
- @cart_item = current_cart.add_boxlunch(boxlunch.id)
173
+ @cart = current_cart.add_boxlunch(boxlunch.id)
167
-       #カレントカートは、アプリケーションコントローラーで定義しています。
168
- if @cart_item.save
174
+ if @cart.save
169
- redirect_to cart_item_path(current_user)
175
+ redirect_to cart_path(current_user)
170
- else
176
+ else
171
- render :new
177
+ render :new
178
+ end
172
179
  end
180
+
181
+ private
182
+ def cart_params
183
+ params.require(:cart).permit(:boxlunch_quantity);
184
+ end
173
185
  end
186
+ ```
174
187
 
175
- private
176
- def cart_item_params
177
- params.require(:cart_item).permit(:boxlunch_quantity);
178
- end
179
- end
180
188
 
181
- ```
182
189
  -----------------------------------------------------------------
183
190
 
184
191
  以上のような状況です。
185
192
  お忙しい中ですが、教えていただけますと助かります。
186
193
 
187
- 宜しくお願いいたします。
194
+ 宜しくお願いいたします。
188
-
189
-  追記:![イメージ説明](63ac201d7b440b2af5dd6022837710d1.png)

6

追記

2020/01/13 14:57

投稿

nissyan
nissyan

スコア15

title CHANGED
File without changes
body CHANGED
@@ -11,11 +11,25 @@
11
11
 
12
12
  -----------------------------------------------------------------
13
13
 
14
+ ```ruby
15
+ index前のコントローラーになります。
16
+ class BoxlunchesController < ApplicationController
17
+ def index
18
+ @boxlunches = Boxlunch.all
19
+ @cart_item = CartItem.new
20
+ end
14
21
 
22
+ def show
23
+ end
24
+ end
25
+
26
+ ```
27
+ -------------------------------------------------
15
28
  課題:
16
29
  商品一覧画面から、商品の個数(boxlunch_quantity)を選択し、formで値を送信するが、boxlunch_quantityのみ保存されない
17
30
  ※boxlunch_idはcart_itemテーブルに保存されます。
18
31
 
32
+
19
33
  ```Ruby
20
34
  index.html.haml
21
35
 

5

画像追記

2020/01/13 10:43

投稿

nissyan
nissyan

スコア15

title CHANGED
File without changes
body CHANGED
@@ -170,4 +170,6 @@
170
170
  以上のような状況です。
171
171
  お忙しい中ですが、教えていただけますと助かります。
172
172
 
173
- 宜しくお願いいたします。
173
+ 宜しくお願いいたします。
174
+
175
+  追記:![イメージ説明](63ac201d7b440b2af5dd6022837710d1.png)

4

訂正

2020/01/13 10:27

投稿

nissyan
nissyan

スコア15

title CHANGED
File without changes
body CHANGED
@@ -92,6 +92,36 @@
92
92
 
93
93
  ----------------------------------------------------------------------------
94
94
 
95
+
96
+ アプリケーションコントローラーのコード
97
+ ※current_cartを定義しています。
98
+ ```ruby
99
+ class ApplicationController < ActionController::Base
100
+ protect_from_forgery with: :exception
101
+ before_action :authenticate_user!
102
+
103
+
104
+ def after_sign_in_path_for(resource)
105
+ root_path # ログイン後に遷移するpathを設定
106
+ end
107
+
108
+ def after_sign_out_path_for(resource)
109
+ root_path # ログアウト後に遷移するpathを設定
110
+ end
111
+
112
+ private
113
+ def current_cart
114
+ @current_cart = Order.find_by(id: session[:order_id])
115
+ @current_cart = Order.create unless @current_cart
116
+ session[:order_id] = @current_cart.id
117
+ @current_cart
118
+ end
119
+ end
120
+
121
+ ```
122
+
123
+ --------------------------------------------------------------------------
124
+
95
125
  カートアイテムのモデルコード
96
126
  ```ruby
97
127
  class CartItem < ApplicationRecord
@@ -135,38 +165,8 @@
135
165
  end
136
166
 
137
167
  ```
168
+ -----------------------------------------------------------------
138
169
 
139
- ----------------------------------
140
-
141
- アプリケーションコントローラーのコード
142
- ※current_cartを定義しています。
143
- ```ruby
144
- class ApplicationController < ActionController::Base
145
- protect_from_forgery with: :exception
146
- before_action :authenticate_user!
147
-
148
-
149
- def after_sign_in_path_for(resource)
150
- root_path # ログイン後に遷移するpathを設定
151
- end
152
-
153
- def after_sign_out_path_for(resource)
154
- root_path # ログアウト後に遷移するpathを設定
155
- end
156
-
157
- private
158
- def current_cart
159
- @current_cart = Order.find_by(id: session[:order_id])
160
- @current_cart = Order.create unless @current_cart
161
- session[:order_id] = @current_cart.id
162
- @current_cart
163
- end
164
- end
165
-
166
- ```
167
-
168
- --------------------------------------------------------------------------
169
-
170
170
  以上のような状況です。
171
171
  お忙しい中ですが、教えていただけますと助かります。
172
172
 

3

訂正

2020/01/13 08:44

投稿

nissyan
nissyan

スコア15

title CHANGED
File without changes
body CHANGED
@@ -45,7 +45,7 @@
45
45
  ----------------------------------------------------------------------------
46
46
 
47
47
  エラー内容
48
- chromeではエラーは表示されていないので
48
+ ブラウザーではエラーは表示されていないので
49
49
  ターミナルでの記載になります。
50
50
  ```ruby
51
51
  ターミナル

2

code修正

2020/01/13 08:41

投稿

nissyan
nissyan

スコア15

title CHANGED
File without changes
body CHANGED
@@ -1,4 +1,3 @@
1
- 現状:
2
1
  Ruby on Railsでショッピングカート機能を実装しています。
3
2
  商品一覧画面から、商品の個数を選択してcart_itemテーブルに保存したい状況です。
4
3
  ※cart_itemテーブルはsessionで仮に商品を保存するためのテーブルとなってます。
@@ -17,10 +16,10 @@
17
16
  商品一覧画面から、商品の個数(boxlunch_quantity)を選択し、formで値を送信するが、boxlunch_quantityのみ保存されない
18
17
  ※boxlunch_idはcart_itemテーブルに保存されます。
19
18
 
19
+ ```Ruby
20
+ index.html.haml
20
21
 
21
- view/商品一覧index.html.haml
22
-
23
- .menu-contents
22
+ .menu-contents
24
23
  - @boxlunches.each do |boxlunch|
25
24
  = form_for @cart_item, url: cart_items_path(boxlunch_id: boxlunch.id), method: :post do |f|
26
25
  .menu-package
@@ -38,13 +37,18 @@
38
37
  %label
39
38
  =f.select :boxlunch_quantity, options_for_select(1..10), include_blank: '0'
40
39
  =f.submit "カートの中に入れる"
40
+ ```
41
41
 
42
+
43
+
44
+
42
45
  ----------------------------------------------------------------------------
43
46
 
44
47
  エラー内容
45
48
  chromeではエラーは表示されていないので
46
49
  ターミナルでの記載になります。
47
-
50
+ ```ruby
51
+ ターミナル
48
52
  Started POST "/cart_items?boxlunch_id=2" for ::1 at 2020-01-12 23:54:40 +0900
49
53
  Processing by CartItemsController#create as HTML
50
54
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"NOg0zYOHm2sCIqeRmMCdz+pUbAfOax99Uy2cOnp4/CO4WwgRUsFUMg2RA0EYXS9VBHrBQ1HZAuQJsqaOGDtV+Q==", "cart_item"=>{"boxlunch_quantity"=>"2"}, "commit"=>"カートの中に入れる", "boxlunch_id"=>"2"}
@@ -81,11 +85,15 @@
81
85
  Rendered cart_items/show.html.haml within layouts/application (1.6ms)
82
86
  Completed 200 OK in 72ms (Views: 68.7ms | ActiveRecord: 0.0ms)
83
87
 
88
+ ```
84
89
 
85
90
 
91
+
92
+
86
93
  ----------------------------------------------------------------------------
87
94
 
88
95
  カートアイテムのモデルコード
96
+ ```ruby
89
97
  class CartItem < ApplicationRecord
90
98
  belongs_to :order
91
99
  has_many :boxlunches
@@ -93,23 +101,26 @@
93
101
 
94
102
  def add_boxlunch(boxlunch_id)
95
103
  cart_items.find_or_initialize_by(boxlunch_id: boxlunch_id)
96
- end
104
+ end
97
105
 
98
- def add_single_menu(single_menu_id)
106
+ def add_single_menu(single_menu_id)
99
- cart_items.find_or_initialize_by(single_menu_id: single_menu_id)
107
+ cart_items.find_or_initialize_by(single_menu_id: single_menu_id)
100
- end
108
+ end
101
109
  end
110
+ ```
102
111
 
112
+
103
113
  -------------------------------------------------------------
104
114
 
105
115
  カートアイテムのコントローラーのコード
116
+ ```ruby
106
117
  class CartItemsController < ApplicationController
107
118
 
108
119
  def create
109
120
  cart = current_cart
110
121
  boxlunch = Boxlunch.find(params[:boxlunch_id])
111
122
  @cart_item = current_cart.add_boxlunch(boxlunch.id)
112
-       カレントカートは、アプリケーションコントローラーで定義しています。
123
+       #カレントカートは、アプリケーションコントローラーで定義しています。
113
124
  if @cart_item.save
114
125
  redirect_to cart_item_path(current_user)
115
126
  else
@@ -123,12 +134,14 @@
123
134
  end
124
135
  end
125
136
 
137
+ ```
138
+
126
139
  ----------------------------------
127
140
 
128
141
  アプリケーションコントローラーのコード
129
142
  ※current_cartを定義しています。
130
-
143
+ ```ruby
131
- class ApplicationController < ActionController::Base
144
+ class ApplicationController < ActionController::Base
132
145
  protect_from_forgery with: :exception
133
146
  before_action :authenticate_user!
134
147
 
@@ -150,6 +163,8 @@
150
163
  end
151
164
  end
152
165
 
166
+ ```
167
+
153
168
  --------------------------------------------------------------------------
154
169
 
155
170
  以上のような状況です。

1

エラー内容の記載

2020/01/13 08:40

投稿

nissyan
nissyan

スコア15

title CHANGED
File without changes
body CHANGED
@@ -41,6 +41,50 @@
41
41
 
42
42
  ----------------------------------------------------------------------------
43
43
 
44
+ エラー内容
45
+ chromeではエラーは表示されていないので
46
+ ターミナルでの記載になります。
47
+
48
+ Started POST "/cart_items?boxlunch_id=2" for ::1 at 2020-01-12 23:54:40 +0900
49
+ Processing by CartItemsController#create as HTML
50
+ Parameters: {"utf8"=>"✓", "authenticity_token"=>"NOg0zYOHm2sCIqeRmMCdz+pUbAfOax99Uy2cOnp4/CO4WwgRUsFUMg2RA0EYXS9VBHrBQ1HZAuQJsqaOGDtV+Q==", "cart_item"=>{"boxlunch_quantity"=>"2"}, "commit"=>"カートの中に入れる", "boxlunch_id"=>"2"}
51
+ Order Load (0.9ms) SELECT "orders".* FROM "orders" WHERE "orders"."id" IS NULL LIMIT $1 [["LIMIT", 1]]
52
+ ↳ app/controllers/application_controller.rb:16
53
+ (0.2ms) BEGIN
54
+ ↳ app/controllers/application_controller.rb:17
55
+ (0.4ms) ROLLBACK
56
+ ↳ app/controllers/application_controller.rb:17
57
+ Boxlunch Load (1.0ms) SELECT "boxlunches".* FROM "boxlunches" WHERE "boxlunches"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]]
58
+ ↳ app/controllers/cart_items_controller.rb:5
59
+ Order Load (0.3ms) SELECT "orders".* FROM "orders" WHERE "orders"."id" IS NULL LIMIT $1 [["LIMIT", 1]]
60
+ ↳ app/controllers/application_controller.rb:16
61
+ (0.2ms) BEGIN
62
+ ↳ app/controllers/application_controller.rb:17
63
+ (0.1ms) ROLLBACK
64
+ ↳ app/controllers/application_controller.rb:17
65
+ (0.2ms) BEGIN
66
+ ↳ app/controllers/cart_items_controller.rb:7
67
+ CartItem Create (0.9ms) INSERT INTO "cart_items" ("boxlunch_id", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["boxlunch_id", 2], ["created_at", "2020-01-12 14:54:40.381901"], ["updated_at", "2020-01-12 14:54:40.381901"]]
68
+ ↳ app/controllers/cart_items_controller.rb:7
69
+ (0.5ms) COMMIT
70
+ ↳ app/controllers/cart_items_controller.rb:7
71
+ User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", 1], ["LIMIT", 1]]
72
+ ↳ app/controllers/cart_items_controller.rb:8
73
+ Redirected to http://localhost:3000/cart_items/1
74
+ Completed 302 Found in 33ms (ActiveRecord: 5.3ms)
75
+
76
+
77
+ Started GET "/cart_items/1" for ::1 at 2020-01-12 23:54:40 +0900
78
+ Processing by CartItemsController#show as HTML
79
+ Parameters: {"id"=>"1"}
80
+ Rendering cart_items/show.html.haml within layouts/application
81
+ Rendered cart_items/show.html.haml within layouts/application (1.6ms)
82
+ Completed 200 OK in 72ms (Views: 68.7ms | ActiveRecord: 0.0ms)
83
+
84
+
85
+
86
+ ----------------------------------------------------------------------------
87
+
44
88
  カートアイテムのモデルコード
45
89
  class CartItem < ApplicationRecord
46
90
  belongs_to :order