Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Things to Notice Before Upgrading Rails Application

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 706
    Comment on it

    Hi Friends,

    Whenever you create an application it is never for lifetime, there is always something and better comes in the market, and once we talk about rails application, it comes pretty quickly. After every few months rails comes with a new version, and we are ready with talks whether to update application or not. So these are the points that we should keep in our mind before upgrading our project to a higher level of rails version.


    1. Full Test coverage is required:

    In rails whenever you upgrade to a new version, it changes a lot, so it is required to test each and every functionality for every case, which is not a good way of testing. Thus before updating the rails application, we must have test cases written that cover most portion of the code and functionality, so that we don't need to test each and every functionality manually.

    2. Move Step by Step:

    Second most important thing is never switch to the latest version available directly. The best way of upgradation step by step upgrade your versions. So suppose your code is on version 3.0, then you should never target to go to 5.0 directly. First you should go to 3.1, then 3.2 then 4 and so on. In short move one minor version at a time.

    These can be steps to follow:

    a) Write test cases for the whole application
    b) Make sure all test cases pass
    c) Upgrade to the next minor version
    d) After upgradation again run the test cases and test

    So this is the simplest and safest way to upgrade the rails application.


    3. Keep in mind the Ruby versions:

    Rails is a framework for Ruby, so as you update rails version, it is also required to update the ruby version as well. These are dependencies of different rails version over ruby versions which are recommended:

    a) Rails 5 : Ruby 2.2.2 or newer
    b) Rails 4 : Above Ruby 1.9.3
    c) Rails 3.2.x : Ruby 1.8.7 or newer
    d) Rails 3 : Ruby 1.8.7 or newer


    4. Update Task of Ruby:

    After updating the rails version in the Gemfile in your application, there is a task that needs to be run which updates all the gems and their dependencies and also provides an interactive interface to update all the other necessary things:

     

    ## For rails 4.2 +
    
    $ rails app:update
       identical  config/boot.rb
           exist  config
        conflict  config/routes.rb
    Overwrite /myapp/config/routes.rb? (enter "h" for help) [Ynaqdh]
           force  config/routes.rb
        conflict  config/application.rb
    Overwrite /myapp/config/application.rb? (enter "h" for help) [Ynaqdh]
           force  config/application.rb
        conflict  config/environment.rb
    ...
    
    
    ## For rails 4.2 or earlier
    
    $ rails app:update
       identical  config/boot.rb
           exist  config
        conflict  config/routes.rb
    Overwrite /myapp/config/routes.rb? (enter "h" for help) [Ynaqdh]
           force  config/routes.rb
        conflict  config/application.rb
    Overwrite /myapp/config/application.rb? (enter "h" for help) [Ynaqdh]
           force  config/application.rb
        conflict  config/environment.rb
    ...
    
    


    Hope you liked reading this.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: