LoginSignup
5
0

More than 3 years have passed since last update.

【Rails】NoMethodError: undefined method `new' for BigDecimal:Classの対処法

Last updated at Posted at 2020-08-30

はじめに

NoMethodError: undefined method 'new' for BigDecimal:Classの詳しい対処法が日本語であまり載ってなさそうなので、備忘録として残しておきます。

対処法

結論として
Gemfilebigdecimalを下記内容に修正したら、うまく行きました。

gem 'bigdecimal', '1.3.5'

gemの内容を書き換えたのでその内容を反映させるために、bundle installを行なってください。

$ bundle install

意味

バージョン 特徴 サポートされているRubyのバージョン範囲
2.0.0 BigDecimal.newとサブクラス化の使用ができない 2.4 ..
1.4.x BigDecimal.newとサブクラス化を使用の際、警告がいつも表示される 2.3 .. 2.6
1.3.5 警告なしでBigDecimal.newとサブクラス化を使用できる .. 2.5

参考
https://stackoverflow.com/questions/60226893/rails-nomethoderror-undefined-method-new-for-bigdecimalclass
https://github.com/ruby/bigdecimal#which-version-should-you-select

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