When to update ruby gems?

I was wondering when is it safe to update gems in a rails project and I came across Semantic Versioning.

Semantic versioning is a way to convey messages about the changes made on software by just comparing old to new version. It is generic, not related to ruby gems only.

On each release, software is tagged with a version. There are three parts X.Y.Z also called versions:

  • X: Major version, Incompatible changes
  • Y: Minor version, New functionality with backwards compatibility
  • Z: Patch version, Bug fix with backwards compatibility


An example, if your current version is 4.1.6, which of following would be safe updates?

  • 4.2.0
  • 4.1.7
  • 5.0.0
And the answer is... 4.1.7 & 4.2.0 because they are about bug fixes and new functionality, both with backwards compatibility.

Rule of thumb, update only when the 2nd or 3rd digit are changed.
Why? Because there's backwards compatibility and your application won't break.

To read more about semantic versioning
comments powered by Disqus