DEV Community

How to migrate monolith to the scary new version of Rails

Dmitry Salahutdinov on September 25, 2018

Migration to the new version of Rails always looks scary. Thinking about the upgrade raises many questions, especially if your application is an ol...
Collapse
 
jules2689 profile image
Julian Nadeau • Edited

We have some resources from Shopify put together by Rafael, Rails' core contributor, and our Rails team at Shopify.

Upgrading the Monolith to Rails 5: engineering.shopify.com/blogs/engi...
Deprecation Toolkit: engineering.shopify.com/blogs/engi...

Hope these help :)

Collapse
 
dsalahutdinov profile image
Dmitry Salahutdinov

Julian! Thank you very much for providing links, I've added them to "Futher Reading" section.
Deprecation Toolkit looks very helpful πŸ‘

Collapse
 
napolskih profile image
Collapse
 
bibendi profile image
Misha Merkushin

Thank you, Dmitry! It is always nice to see who doesn't hide the experience and shares it with a community even though it's not unique. There will be less shit code in the world - what is important!

BTW, I've one remark. Don't use rails_next? outside of Gemfile. Because when you'll do the second and following upgrades then your code will be broken. Use only Rails::VERSION for the checks. I see that you write about that is temporary, but there is always a probability of forgetting about it =)

e.g.:

If we have Rails v4.2 this code is working well.

if rails_next?
  method_working_on_5_0_and_higher
else
  method_working_on_4_2
end

But after the transition to v5.0 it will be broken.

I suggest always to use clean version conditions.

if Rails::VERSION >= '5.0'
  method_working_on_5_0_and_higher
else
  method_working_on_4_2
end
Collapse
 
dsalahutdinov profile image
Dmitry Salahutdinov

Hey, Michail! Nice catch, thank you for the note!

It depends on the flow you use. If you clean up all the rails_next? checks after any upgrade iteration - it's okay

But checking with Rails::VERSION is much flexible I think.

Collapse
 
ben profile image
Ben Halpern

Dual boot is a concept that had not come across my radar but makes a lot of sense.

Thanks for a great overall article, definitely reference material for our next upgrade. cc: @maestromac