# Ruby versions: "required" vs "preferred"

**URL:** <https://discuss.rubyonrails.org/t/ruby-versions-required-vs-preferred/83945>\
**Category:** rubyonrails-docs\
**Created:** [October 16, 2023, 10:37am UTC](https://discuss.rubyonrails.org/t/ruby-versions-required-vs-preferred/83945 "2023-10-16T10:37:18Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![claasz](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/claasz/32/5017_2.png) [@claasz](https://discuss.rubyonrails.org/u/claasz)\
**Post date:** [October 16, 2023, 10:37am UTC](https://discuss.rubyonrails.org/t/ruby-versions-required-vs-preferred/83945/1 "2023-10-16T10:37:18Z")

</div>

I know that I can find out the minimum Ruby version required for a Rails project by looking at `rails.gemspec` file.

For some Rails versions, the required Ruby version is mentioned in the Release Notes. (I really cannot understand why something **fundamental like the minimum Ruby version required** is not listed in each and every Release Note or in some dedicated documentation page?!)

Anyway, the 7.0 Release Notes also mention a “preferred” Ruby version (“Ruby 2.7.0+ required, Ruby 3.0+ preferred”).

So my questions are:

- What does it mean that a Ruby version is “preferred”?
- In case the “preferred” Ruby version is not mentioned, does it mean it is the same as in the last previous release which mentions the “preferred” version?

---

<div class="post-metadata">

**Author:** ![Bala\_Paranj1](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/bala_paranj1/32/11025_2.png) [@Bala\_Paranj1](https://discuss.rubyonrails.org/u/Bala_Paranj1)\
**Post date:** [January 11, 2024, 4:46pm UTC](https://discuss.rubyonrails.org/t/ruby-versions-required-vs-preferred/83945/2 "2024-01-11T16:46:31Z")

</div>

The “preferred” version is a suggestion for optimal performance and compatibility. It is not a strict requirement. If it is not mentioned, it’s safer to rely on the latest stable version compatible with your Rails version. I refer [Ruby & Rails Compatibility Table - FastRuby.io | Rails Upgrade Service](https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html) very frequently. I think the Rails documentation should include this compatibility table.

---

<div class="post-metadata">

**Author:** ![claasz](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/claasz/32/5017_2.png) [@claasz](https://discuss.rubyonrails.org/u/claasz)\
**Post date:** [January 12, 2024, 8:34am UTC](https://discuss.rubyonrails.org/t/ruby-versions-required-vs-preferred/83945/3 "2024-01-12T08:34:58Z")

</div>

What do you mean by “optimal compatibility”? From my understanding, it’s either compatible or not?

---

<div class="post-metadata">

**Author:** ![Bala\_Paranj1](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/bala_paranj1/32/11025_2.png) [@Bala\_Paranj1](https://discuss.rubyonrails.org/u/Bala_Paranj1)\
**Post date:** [January 12, 2024, 2:45pm UTC](https://discuss.rubyonrails.org/t/ruby-versions-required-vs-preferred/83945/4 "2024-01-12T14:45:48Z")

</div>

Yes, that is correct. The flowery language is due to my cousin Vinny the GPT-4.

---

<div class="post-metadata">

**Author:** ![walterdavis](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/walterdavis/32/705_2.png) [@walterdavis](https://discuss.rubyonrails.org/u/walterdavis)\
**Post date:** [January 12, 2024, 3:08pm UTC](https://discuss.rubyonrails.org/t/ruby-versions-required-vs-preferred/83945/5 "2024-01-12T15:08:11Z")

</div>

And there is a degree of truth to that shading of compatibility. Often times you may find that a newest version of Ruby runs a given app really well most of the time. Until you get into an edge case in a gem or other third-party resource that doesn’t support the new syntax, or worse, has a subtle flaw that the newest Ruby rejects. I am thinking here of how in older 2.x Ruby, you sometimes needed to wrap keyword arguments in a hash literal, while in 3.x those are a compile error. Your app might run well until you hit something that lazily-loads that module, and then Bam!

Walter

---

<div class="post-metadata">

**Author:** ![claasz](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/claasz/32/5017_2.png) [@claasz](https://discuss.rubyonrails.org/u/claasz)\
**Post date:** [January 12, 2024, 3:13pm UTC](https://discuss.rubyonrails.org/t/ruby-versions-required-vs-preferred/83945/6 "2024-01-12T15:13:58Z")

</div>

If I’m interested in asking ChatGPT this question, I can do that by myself, thank you. No need to copy + paste to here.

---

<div class="post-metadata">

**Author:** ![Bala\_Paranj1](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/bala_paranj1/32/11025_2.png) [@Bala\_Paranj1](https://discuss.rubyonrails.org/u/Bala_Paranj1)\
**Post date:** [January 12, 2024, 4:05pm UTC](https://discuss.rubyonrails.org/t/ruby-versions-required-vs-preferred/83945/7 "2024-01-12T16:05:25Z")

</div>

Then ask it first. Use the existing resources before you post the question here.

---

<div class="post-metadata">

**Author:** ![claasz](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/claasz/32/5017_2.png) [@claasz](https://discuss.rubyonrails.org/u/claasz)\
**Post date:** [January 12, 2024, 4:31pm UTC](https://discuss.rubyonrails.org/t/ruby-versions-required-vs-preferred/83945/8 "2024-01-12T16:31:10Z")

</div>

“Preferred version” could actually mean many things. E.g.

- It’s `preferred` because in the next release, it will become `required`, so you’ll have an easier time when upgrading
- We’ve run some performance tests, and it runs much faster on the `preferred` version than on the `required` version
- While CI runs on `required` and on `preferred`, we know some large applications running on `preferred` in production
- Popular Ruby gems already require `preferred`, so you’ll have an easier time developing a new app
- At the (Rails) release date, we already know that `required` will be EOL in X months. That’s why we recommend anybody to use `preferred`
- Etc.

So my question was what’s the _Rails maintainer’s understanding_ of `preferred`, and why they sometimes mention it and sometimes not.

---

<div class="post-metadata">

**Author:** ![Bala\_Paranj1](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/bala_paranj1/32/11025_2.png) [@Bala\_Paranj1](https://discuss.rubyonrails.org/u/Bala_Paranj1)\
**Post date:** [January 12, 2024, 5:04pm UTC](https://discuss.rubyonrails.org/t/ruby-versions-required-vs-preferred/83945/9 "2024-01-12T17:04:04Z")

</div>

I suggest you open a Documentation PR for this. Document your findings. Someone from the Rails core team will review. This is the best way to confirm your understanding is right and also contribute to the documentation of Rails. You can learn from the best.
