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

質問編集履歴

2

orderモデルの追加

2020/08/17 04:07

投稿

takatin
takatin

スコア7

title CHANGED
File without changes
body CHANGED
@@ -70,4 +70,12 @@
70
70
  Rendered end_users/orders/complete.html.erb within layouts/end_users (0.5ms)
71
71
  Completed 200 OK in 894ms (Views: 835.0ms | ActiveRecord: 32.6ms)
72
72
 
73
+ ```
74
+ ```ここに言語を入力
75
+ order.rb
76
+ class Order < ApplicationRecord
77
+ enum payment: {クレジットカード:1, 銀行振込:2}
78
+ belongs_to :end_user
79
+ enum order_status: {入金待ち:0, 入金確認:1, 製作中:2,発送準備中:3, 発送済み:4}
80
+ end
73
81
  ```

1

schemaとlogの追加

2020/08/17 04:07

投稿

takatin
takatin

スコア7

title CHANGED
File without changes
body CHANGED
@@ -34,4 +34,40 @@
34
34
  end
35
35
 
36
36
  end
37
+ ```
38
+ ```
39
+ schema.rb
40
+ create_table "orders", force: :cascade do |t|
41
+ t.integer "end_user_id"
42
+ t.string "dear_name"
43
+ t.string "order_address"
44
+ t.string "postal_code"
45
+ t.integer "total"
46
+ t.integer "postage", default: 800
47
+ t.string "payment"
48
+ t.integer "order_status"
49
+ t.datetime "created_at", null: false
50
+ t.datetime "updated_at", null: false
51
+ end
52
+ ```
53
+ ```ここに言語を入力
54
+ Started POST "/end_users/orders" for 10.0.2.2 at 2020-08-16 12:00:22 +0000
55
+ Cannot render console from 10.0.2.2! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
56
+ Processing by EndUsers::OrdersController#create as HTML
57
+ 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"=>"購入を確定する"}
58
+ Unpermitted parameter: :end_user_id
59
+ 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]]
60
+ ↳ app/controllers/end_users/orders_controller.rb:9
61
+ (0.1ms) begin transaction
62
+ ↳ app/controllers/end_users/orders_controller.rb:29
63
+ EndUser Load (2.5ms) SELECT "end_users".* FROM "end_users" WHERE "end_users"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]]
64
+ ↳ app/controllers/end_users/orders_controller.rb:29
65
+ 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"]]
66
+ ↳ app/controllers/end_users/orders_controller.rb:29
67
+ (21.0ms) commit transaction
68
+ ↳ app/controllers/end_users/orders_controller.rb:29
69
+ Rendering end_users/orders/complete.html.erb within layouts/end_users
70
+ Rendered end_users/orders/complete.html.erb within layouts/end_users (0.5ms)
71
+ Completed 200 OK in 894ms (Views: 835.0ms | ActiveRecord: 32.6ms)
72
+
37
73
  ```