Useful links for Rails Upgrade

Tools, guides, tips, checklists and other helpful info for Rails update
19 June 2017   1035

New RoR release brings many new features, better security, and increased performance. But depending on many factors, it's often not easy to upgrade your version. When you finally decided, you want it to be fast and safe.

In order to make update process comfortable, here is the list helpful tools, guides, checklists and other resources about updating Ruby. Some of them are related only for 4.x or 5.x, other are universal.

Universal resources

Ruby on Rails

Framework written in the Ruby programming language
 

Ruby

Dynamic, open source programming language with a focus on simplicity and productivity

List of the resources, that will help with update of any version.

Rails Official Release Guides

rails guidesRailsGuides interface

First place you should begin to search info about Rails update is the official release guides. With the newest version of Rails new guide is also uploaded. Guides are available from 3.0 up to 5.1. These materials are useful for covering the basic changes of each version and for handy tips. 

Rails Upgrate Checklist

Rails Upgrate Checklist
Rails Upgrade Checklist interface

Rails Upgrade Checklist is one of the most useful resources for anyone, who needs his Rails to be updated. Provides a starting point and helps to plan steps of your Rails update, depending on a version. At the moment, this check list is only for Rails 4 or lower. You can create pull requests to update the list here

RailsDiff

RailsDiff interface
RailsDiff interface

Very useful resource, that helps to find Rails documentation for each release. It covers all Rails code change from 2.3.6 to 5.1.1. Website provides line by line demonstration of changes in Rails app. For every separate Gem you use, you will have to make a test in your app. For someone that faced first update or for someone with no clue where to begin, RailsDiff is great tool.

Stackoverflow

StackoverflowStackoverflow interface

Stackoverflow is well known as a helping resource, driven by community. Here you can ask any questions, regarding Ruby and Rails. Also, there's a lot of ready-made answers for every issue. For example, big thread about update from 4.2.6 to 5.0.

Reddit

Rails section at Reddit
Rails section at Reddit

Same as StackOverflow, Reddit is community driven resources with answers to large amount of web development issues. It has Rails community, when you can ask both technical and career questions, Rails update issues is not exception. 

Updating to Rails 5.x

Next links will be helpful for those, who plans to upgrade their Rails to version 5.0 or higher.

Is a gem ready for Rails 4 or 5?

ready4rails interface
Ready4rails interface

By using this interesting website, you can figure out, are your key gems ready for upgrade or not. You can find what gems will cause conflicts and which ones are ready for upgrade. If some of your gems aren't ready for an update, it's good to wait for an update then look for another solution.

To stay updated on security files and other updates, you can use VersionEye tool. This solution checks your Git repository and informs you with any changes. 

Updating to Rails 5.0 by Daniel Kehoe

Updating to Rails 5.0 by Daniel Kehoe
Updating to Rails 5.0 by Daniel Kehoe

This big article-tutorial covers the topic of using RVM for managing of Rails version. You are free to use chruby or rbenv or you can follow exactly for Ruby Version Manager.

Rails 4.x and higher upgrade

If your Rails are few versions below, it is necessary to upgrade them. The easiest way is to  go version by version. Here are some helpful resources for apps, that are on 3.x version.

Book "Upgrade to Rails 4" by Philip De Smedt

Upgrade to Rails 4
"Upgrade to Rails 4" cover

This ebook includes 32 chapters on different Rails 4 features, along with a detailed checklist for upgrading. It is good to have all necessary info by the hand when you are doing an update.

Screencast "Upgrading to Rails 4" 

Upgrading to Rails 4 screencast 
Upgrading to Rails 4 screencast 

RailsCast is great resource for those, who like to learn visual. If you're updating your Rails to 4.x, RailCast created a screencast displaying the process for updating. The video takes you through the spots with main changes, and you can watch in real time.

How to Upgrade to Rails 4.2 by Justin Weiss

How to Upgrade to Rails 4.2 by Justin Weiss webpage
How to Upgrade to Rails 4.2 by Justin Weiss webpage

Justin provides some good tips for upgrading a Rails app to version 4.2. This tutorial shortly covers testing, Rails gem updates, and more. It doesn’t dig into the deep details, but is a good proffesional view of the best strategy for upgrading.

How To Upgrade a Big Legacy App to Rails 4

HOW TO UPGRADE A BIG LEGACY APP TO RAILS 4 webpage
How To Upgrade a Big Legacy App to Rails 4 webpage

If you’re planning an upgrade for a big app, this article will give you overview how one team did it. This covers the creating of the development team, how good planning played a big role in the update, and the technical updates that were made along the way. If your team isn’t planning an update, this article also helps explain resource allocation and how features and technical stuff were balanced. 

When I update rails, my go-to solution is Rails Diff. Also Rails Guides is a must-see resource since it’s written by the new features authors. Stackoverflow happens all the time since many gems are not so up to date, so sometimes Google sends me there first. Never used reddit btw.
 

Dima Koprov
Team Lead at Evrone

What link was the most useful for you?

DateTime, Timestamp, Time and Date in Rails

Learn about key differenece between DateTime, Timestamp, Time and Date in Rails
31 October 2017   624

The difference between different date/time formats in ActiveRecord have little to do with Rails and everything to do with whatever database you're using.

Using MySQL as an example (if for no other reason because it's most popular), you have DATEDATETIMETIME and TIMESTAMP column data types; just as you have CHARVARCHARFLOATand INTEGER.

So, main differences: DATE only stores a date, TIME only stores a time of day, while DATETIME stores both.

The difference between DATETIME and TIMESTAMP is a bit more subtle: DATETIME is formatted as YYYY-MM-DD HH:MM:SS. Valid ranges go from the year 1000 to the year 9999 and everything in between. While TIMESTAMP looks similar when you fetch it from the database, it's really a just a front for a unix timestamp. Its valid range goes from 1970 to 2038. The difference here, aside from the various built-in functions within the database engine, is storage space. Because DATETIMEstores every digit in the year, month day, hour, minute and second, it uses up a total of 8 bytes. As TIMESTAMP only stores the number of seconds since 1970-01-01, it uses 4 bytes.

You can read more about the differences between time formats in MySQL here.

In the end, it comes down to what you need your date/time column to do. Do you need to store dates and times before 1970 or after 2038? Use DATETIME. Do you need to worry about database size and you're within that timerange? Use TIMESTAMP. Do you only need to store a date? Use DATE. Do you only need to store a time? Use TIME.

Having said all of this, Rails actually makes some of these decisions for you. Both :timestamp and :datetime will default to DATETIME, while :date and :time corresponds to DATE and TIME, respectively.