payjpを利用しています。購入履歴ページを作りたいのです。がそのためにはカード情報を保存するcardモデルにbelongs_to :postと書かないと行けないのですが、そうするとカードが保存できなくなります。
一応「登録が完了しました」とはでますが実際にはできていません。
log
1 User Load (1.7ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", 1], ["LIMIT", 1]] 2 ↳ app/controllers/card_controller.rb:16:in `pay' 3Redirected to http://localhost:3000/card/pay 4Completed 302 Found in 1179ms (ActiveRecord: 1.7ms | Allocations: 5592) 5 6 7Started GET "/card/pay" for ::1 at 2020-09-01 18:17:05 +0900 8Processing by CardController#show as HTML 9 Parameters: {"id"=>"pay"} 10 User Load (1.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", 1], ["LIMIT", 1]] 11 ↳ app/controllers/card_controller.rb:42:in `show' 12 Card Load (1.5ms) SELECT "cards".* FROM "cards" WHERE "cards"."user_id" = $1 ORDER BY 13"cards"."id" ASC LIMIT $2 [["user_id", 1], ["LIMIT", 1]] 14 ↳ app/controllers/card_controller.rb:42:in `show' 15Redirected to http://localhost:3000/card/new 16Completed 302 Found in 867ms (ActiveRecord: 2.9ms | Allocations: 2337) 17 18 19Started GET "/card/new" for ::1 at 2020-09-01 18:17:07 +0900 20Processing by CardController#new as HTML 21 User Load (1.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", 1], ["LIMIT", 1]] 22 ↳ app/controllers/card_controller.rb:5:in `new' 23 Card Exists? (2.0ms) SELECT 1 AS one FROM "cards" WHERE "cards"."user_id" = $1 LIMIT $2 [["user_id", 1], ["LIMIT", 1]] 24 ↳ app/controllers/card_controller.rb:6:in `new' 25 Rendering card/new.html.slim within layouts/application 26 Rendered card/new.html.slim within layouts/application (Duration: 3.6ms | Allocations: 27277) 28[Webpacker] Everything's up-to-date. Nothing to do 29[Webpacker] Everything's up-to-date. Nothing to do 30Completed 200 OK in 1695ms (Views: 1013.1ms | ActiveRecord: 3.6ms | Allocations: 8846)
create_table :cards do |t| t.integer :user_id t.string :customer_id t.integer :post_id t.string :card_id t.timestamps end
postgresSQLを使用しています。
なにかわかる方がいましたら回答お願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。