質問編集履歴

2

orderモデルの追加

2020/08/17 04:07

投稿

takatin
takatin

スコア7

test CHANGED
File without changes
test CHANGED
@@ -143,3 +143,19 @@
143
143
 
144
144
 
145
145
  ```
146
+
147
+ ```ここに言語を入力
148
+
149
+ order.rb
150
+
151
+ class Order < ApplicationRecord
152
+
153
+ enum payment: {クレジットカード:1, 銀行振込:2}
154
+
155
+ belongs_to :end_user
156
+
157
+ enum order_status: {入金待ち:0, 入金確認:1, 製作中:2,発送準備中:3, 発送済み:4}
158
+
159
+ end
160
+
161
+ ```

1

schemaとlogの追加

2020/08/17 04:07

投稿

takatin
takatin

スコア7

test CHANGED
File without changes
test CHANGED
@@ -71,3 +71,75 @@
71
71
  end
72
72
 
73
73
  ```
74
+
75
+ ```
76
+
77
+ schema.rb
78
+
79
+ create_table "orders", force: :cascade do |t|
80
+
81
+ t.integer "end_user_id"
82
+
83
+ t.string "dear_name"
84
+
85
+ t.string "order_address"
86
+
87
+ t.string "postal_code"
88
+
89
+ t.integer "total"
90
+
91
+ t.integer "postage", default: 800
92
+
93
+ t.string "payment"
94
+
95
+ t.integer "order_status"
96
+
97
+ t.datetime "created_at", null: false
98
+
99
+ t.datetime "updated_at", null: false
100
+
101
+ end
102
+
103
+ ```
104
+
105
+ ```ここに言語を入力
106
+
107
+ Started POST "/end_users/orders" for 10.0.2.2 at 2020-08-16 12:00:22 +0000
108
+
109
+ Cannot render console from 10.0.2.2! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
110
+
111
+ Processing by EndUsers::OrdersController#create as HTML
112
+
113
+ Parameters: {"utf8"=>"✓", "authenticity_token"=>"wEBJZdHoHUffp8WQGqIwVsQi6IbNu6W+lend7LO1cyoxZwcjvtbRSR6rDNsZbnGjKUYywToE+mg9wSSHO7jHhA==", "order"=>{"end_user_id"=>"1", "postal_code"=>"555-5555", "order_address"=>"東京都東京区東京町1−1−1", "dear_name"=>"", "total"=>"2100", "payment"=>"クレジットカード", "order_status"=>"入金待ち"}, "commit"=>"購入を確定する"}
114
+
115
+ Unpermitted parameter: :end_user_id
116
+
117
+ EndUser Load (1.9ms) SELECT "end_users".* FROM "end_users" WHERE "end_users"."id" = ? ORDER BY "end_users"."id" ASC LIMIT ? [["id", 1], ["LIMIT", 1]]
118
+
119
+ ↳ app/controllers/end_users/orders_controller.rb:9
120
+
121
+ (0.1ms) begin transaction
122
+
123
+ ↳ app/controllers/end_users/orders_controller.rb:29
124
+
125
+ EndUser Load (2.5ms) SELECT "end_users".* FROM "end_users" WHERE "end_users"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]]
126
+
127
+ ↳ app/controllers/end_users/orders_controller.rb:29
128
+
129
+ Order Create (7.0ms) INSERT INTO "orders" ("end_user_id", "dear_name", "order_address", "postal_code", "total", "payment", "order_status", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) [["end_user_id", 1], ["dear_name", ""], ["order_address", "東京都東京区東京町1−1−1"], ["postal_code", "555-5555"], ["total", 2100], ["payment", 1], ["order_status", 0], ["created_at", "2020-08-16 12:00:22.574470"], ["updated_at", "2020-08-16 12:00:22.574470"]]
130
+
131
+ ↳ app/controllers/end_users/orders_controller.rb:29
132
+
133
+ (21.0ms) commit transaction
134
+
135
+ ↳ app/controllers/end_users/orders_controller.rb:29
136
+
137
+ Rendering end_users/orders/complete.html.erb within layouts/end_users
138
+
139
+ Rendered end_users/orders/complete.html.erb within layouts/end_users (0.5ms)
140
+
141
+ Completed 200 OK in 894ms (Views: 835.0ms | ActiveRecord: 32.6ms)
142
+
143
+
144
+
145
+ ```