From bd021f7eab5f61d68473f8afafafa36175764eb0 Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Sun, 4 Jan 2026 20:30:59 -0600 Subject: [PATCH] Add Check Ruby Version For Production App as a Heroku TIL --- README.md | 3 +- .../check-ruby-version-for-production-app.md | 32 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 heroku/check-ruby-version-for-production-app.md diff --git a/README.md b/README.md index a2670e1..e09f3b5 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ working across different projects via [VisualMode](https://www.visualmode.dev/). For a steady stream of TILs, [sign up for my newsletter](https://visualmode.kit.com/newsletter). -_1719 TILs and counting..._ +_1720 TILs and counting..._ See some of the other learning resources I work on: @@ -502,6 +502,7 @@ If you've learned something here, support my efforts writing daily TILs by ### Heroku +- [Check Ruby Version For Production App](heroku/check-ruby-version-for-production-app.md) - [Connect To A Database By Color](heroku/connect-to-a-database-by-color.md) - [Deploy A Review App To A Different Stack](heroku/deploy-a-review-app-to-a-different-stack.md) - [Diagnose Problems In A Heroku Postgres Database](heroku/diagnose-problems-in-a-heroku-postgres-database.md) diff --git a/heroku/check-ruby-version-for-production-app.md b/heroku/check-ruby-version-for-production-app.md new file mode 100644 index 0000000..4bb7f9c --- /dev/null +++ b/heroku/check-ruby-version-for-production-app.md @@ -0,0 +1,32 @@ +# Check Ruby Version For Production App + +While deploying a fresh Rails app to Heroku recently, I ran into an issue. The +`it` block argument wasn't working despite being on Ruby 4.0. Or so I thought. + +Running the following command reported the Ruby version of that Heroku server +instance: + +```bash +❯ heroku run -- ruby --version +Running ruby --version on ⬢ my-app... up, run.3090 +ruby 3.3.9 (2025-07-24 revision f5c772fc7c) [x86_64-linux] +``` + +I was on `3.3.9` which must have been the fallback default at the time. + +Though I had set the Ruby version in my `.ruby-version` file, I had neglected to +specify it in the `Gemfile` as well. Once I added it to the `Gemfile` and +redeployed, my Heroku server instance was running the expected version of Ruby. + +```bash +❯ heroku run -- ruby --version +Running ruby --version on ⬢ my-app... up, run.5353 +ruby 4.0.0 (2025-12-25 revision 553f1675f3) +PRISM [x86_64-linux] +``` + +Note: because [I have set `HEROKU_ORGANIZATION` and +`HEROKU_APP`](set-default-team-and-app-for-project.md) in my environment +(`.envrc`) for the local copy of the app, I don't need to specify those when +running the `heroku run` command above. + +See `heroku run --help` for more details.