LoginSignup
34
29

More than 5 years have passed since last update.

Ruby の簡単なエラーだけど分からなくなっちゃうエラー

Last updated at Posted at 2017-08-25

エラーメッセージを検索してたどり着くことを期待した記事です。

自分も過去に苦しみました。解決したらいいねしてください。どれに詰まったのかをコメントしていただけると尚良しです

no implicit conversion of Fixnum into String が sort { ... } で出現した時

sort のブロック内で大小の -1 / 0 / 1 を返すのに return を使っていないだろうか。Ruby では next を使おう

no implicit conversion of Symbol into Integer が出たとき

"文字列"[:symbol]

という参照が起こるとこのエラーになる。 :symbol でアクセスしようとしているのが (おそらく Hash を期待して書いたコードだと思われるが、 Hash ではなく) String になっていないだろうか。調べてみよう

34
29
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
34
29