LoginSignup
0
0

More than 3 years have passed since last update.

その3「Rails初心者」が5回連続で発生したエラーをなんとか切り抜けた話。「NoMethodError in IncomeValues#index」

Last updated at Posted at 2020-07-31

前回の「その2」の続きです

前回の記事☞https://qiita.com/Shota_U/items/c93eb669b3f8078785eb

3つ目のエラーです。
image.png

「NoMethodError in IncomeValues#index」

というのがでてきました。

これは、「NillClassにstrftimeなんていうメソッドはないよ」

ということみたいです

そこで、

income_value.year_month.strftime('%Y年%m月')

income_value.year_month&.strftime('%Y年%m月')

としたところ、無事解決できました。

しかし、
また次のエラー「ArgumentError」がでてきてしまいました。。。

これは、正直心折れそうでした(笑)。

その4へ続く👇
https://qiita.com/Shota_U/items/f41a2e0f2a1e24f98fc9

0
0
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
0
0