Ruby 2.5.0 upgrade remarks

There’s a lot of articles already on the new shiny features of Ruby 2.5.0. But here are some problems and challenges you may encounter during the upgrade process.

Devise SyntaxError

If you encounter this error:


the only thing you can do for now, is to edit the devise/sessions_controller.rb in your Devise local location and change:

to (note the brackets):

Note: to determine your local Devise path, use following command:

Probably in few days, there will be a Devise gem release that will fix that for RubyGems as well.

ActionCable Argument Error

If you use ActionCable, then it is a good to postpone the upgrade until this issue is fixed and the upgraded version of ActionCable has been released.

OpenSSL problem

SecureRandom now prefers OS-provided sources over OpenSSL. It also means, that OpenSSL is not required by default, so if you use it in a gem, you will have to add:

or you will end up with an error like this one:

Travis does not yet support 2.5.0

Note: Travis already fixed this one.

If you manage a multi-ruby version library, don’t update Travis yet unless you want to compile Ruby yourself. If you list 2.5.0 as one of the versions, Travis will pick the preview1 instead of the final release and you might end up with an error similar to this one:

yield_self as an incompatibility

Again, if you are a maintained of a multi-ruby version library, don’t forget to backport the yield_self into your code-base if you are planning to use it:

Dir::Tmpname#make_tmpname is no longer available

If you use Dir::Tmpname#make_tmpname, it is no longer available. Long story short: you need to generate unique names on your own. Click here to see how Rails core team did it.

Summary

There aren’t many problems with 2.5.0. All of the things that I’ve encountered are either easy to fix or things that will disappear after few weeks of an adoption time. Long live Ruby core team! :)

Credits

Cover photo by: Victoria Pickering on Attribution-NonCommercial-NoDerivs 2.0 Generic (CC BY-NC-ND 2.0) license. Changes made: added an overlay layer with an article title on top of the original picture.


Originally published at Running with Ruby.