update rails version from 2.x to 5.x in an existing very old rails application

20 views
Skip to first unread message

raj kumar

unread,
Feb 1, 2019, 2:50:32 AM2/1/19
to Ruby on Rails: Talk
I have a Rails app, made 10 years back in 2009 with following version:
rails version = 2.0.2 
ruby version = 1.8.7
Database = PostgreSQL

Now what steps I should adopt in order to upgrade it to latest version of ruby and rails i.e.,
rails version = 5.2
ruby version = 2.6
Database = PostgreSQL

As per up-gradation rule here(https://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html), I need to start up-gradation one by one version gradually like,
2.x to 3.x
3.x to 4.x 
4.x to 5.x

My question here is, 
Is there any other way to directly update it from 2.x to 5.x?

Note: I can develop it by scratch but my client not agree on that, they just asking for update in existing app not build from scratch in latest version of Ruby on Rails.

Kindly provide your thoughts.

Thanks 

Hasan Diwan

unread,
Feb 1, 2019, 3:03:42 AM2/1/19
to rubyonra...@googlegroups.com
To be safe, go through a stepwise upgrade, running and fixing your tests at each step. -- H

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/fa59e599-44bc-4d30-91c6-a048edb9e2ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
If you wish to request my time, please do so using bit.ly/hd1AppointmentRequest.
Si vous voudrais faire connnaisance, allez a bit.ly/hd1AppointmentRequest.

Sent from my mobile device
Envoye de mon portable

Phil Edelbrock

unread,
Feb 1, 2019, 3:17:46 AM2/1/19
to rubyonra...@googlegroups.com

On Feb 1, 2019, at 12:02 AM, Hasan Diwan <hasan...@gmail.com> wrote:

To be safe, go through a stepwise upgrade, running and fixing your tests at each step. -- H

On Thu, 31 Jan 2019 at 23:50, raj kumar <2017...@gmail.com> wrote:
I have a Rails app, made 10 years back in 2009 with following version:
rails version = 2.0.2 
ruby version = 1.8.7
Database = PostgreSQL

Now what steps I should adopt in order to upgrade it to latest version of ruby and rails i.e.,
rails version = 5.2
ruby version = 2.6
Database = PostgreSQL

As per up-gradation rule here(https://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html), I need to start up-gradation one by one version gradually like,
2.x to 3.x
3.x to 4.x 
4.x to 5.x

My question here is, 
Is there any other way to directly update it from 2.x to 5.x?

Note: I can develop it by scratch but my client not agree on that, they just asking for update in existing app not build from scratch in latest version of Ruby on Rails.

Kindly provide your thoughts.

Thanks 

Good advise by Hasan.  If the project isn't that complex, though, you could just jump to the latest.. .sometimes rewriting incrementally can be a painful waste of time just to rewrite again as you go from each increment to the next.

Latest Ruby should be the least of your problems... you will get huge code speedups from nothing more than upgrading Ruby.  Most of the changes to Ruby since 1.8/1.9 to 2.6 have been to garbage collection speedups.

ActiveRecord changes and routes might be your most significant rewrites.  Because we're looking at Rails 6 beta as the current, you could also leapfrog to that?  (depending on your scheduling and policies on using betas)

Good luck!


Phil

Walter Lee Davis

unread,
Feb 1, 2019, 8:19:11 AM2/1/19
to rubyonra...@googlegroups.com

> On Feb 1, 2019, at 3:17 AM, Phil Edelbrock <ede...@gmail.com> wrote:
>
>
>> On Feb 1, 2019, at 12:02 AM, Hasan Diwan <hasan...@gmail.com> wrote:
>>
>> To be safe, go through a stepwise upgrade, running and fixing your tests at each step. -- H
>>
>>
I'll second the idea to rebuild. One of the problems you'll run into is finding authoritative documentation for all the little things you'll need to do to go just from 2.0.2 to 2.3.1 (the last stable 2 branch, IIRC). Then rinse and repeat when you go to 3.0.x etc. That many jumps can easily swamp the amount of time it would take to just rebuild.

Walter

John Ivanoff

unread,
Feb 1, 2019, 10:49:48 AM2/1/19
to Ruby on Rails: Talk
I just halted on an upgrade project due to time constraints. Rails V3 Ruby 1.9.3
It has so many abandoned Gems I had to stop at Rails 3.2.25 and Ruby 2.1
Thankfully it had good test coverage. That was a huge help.
Remember when we started whitelisted attributes in the model and then it was moved to the controller? There's a lot of moving code around.

If you incrementally upgrade you can eventually use 
rails app:update # Update configs and some other initially generated files (or use just update:configs or update:bin)
to help

I would also upgrade bundler to 1.13. You have better control over updating gems. https://bundler.io/man/bundle-update.1.html

My advice un upgrading is the same advice you get when you go white water raftering, and they talk about if you get stuck under the boat, "Pick a direction and go. Don't turn around."
also, git commit often. :-)

John
Reply all
Reply to author
Forward
0 new messages