Upgrade to Ruby 2.7.6
Ruby v2.7.6 is the latest version before v3.0 at the time of this writing and upgrading to v2.7.6 may encounter a breaking issue if the application uses libraries that depend on BigDecimal.
The problem
NoMethodError:
undefined method `new' for BigDecimal:Class
The reason for the above error is since ruby v2.7, the bigdecimal gem is upgraded to v2.0 with a breaking change that drops BigDecimal.new support.
The solution
- For app code, replace
BigDecimal.newwithBigDecimal()
- bd = BigDecimal.new(100)
+ bd = BigDecimal(100)
- For app using database gem such as
mysql2with version older thanv0.5, upgrade the gem tov5.0+in Gemfile and runbundle update mysql2
- gem 'mysql2', '0.4.10'
+ gem 'mysql2', '0.5.4'
- (Not-recommended) Lock
bigdecimalto an older version beforev2.0if no other solutions work, for example
gem 'bigdecimal', '1.4.4'
References