2
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

TypeError (no implicit conversion of Symbol into Integer)のエラー対応

Posted at

エラー内容

TypeError (no implicit conversion of Symbol into Integer)

hashでjsonから値を取りに行ったら上記エラーが

状況

  • rails
  • ruby

エラーの原因

no implicit conversion of Symbol into Integerは数値が来るべきところにsymbolが来ちゃっているよという意味。hashだと思って下記で指定したんだけど

[:items][:data][:price][:product]

配列だったので

[:items][:data][0][:price][:product]

としたら解決。

stripeのsubscriptionを取得しに言ったんだけどよく見たら{}じゃなくて[]だった。

2
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?