mirror of
https://github.com/jbranchaud/til
synced 2026-01-08 17:48:01 +00:00
Add Check Ruby Version For Production App as a Heroku TIL
This commit is contained in:
@@ -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).
|
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:
|
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
|
### 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)
|
- [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)
|
- [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)
|
- [Diagnose Problems In A Heroku Postgres Database](heroku/diagnose-problems-in-a-heroku-postgres-database.md)
|
||||||
|
|||||||
32
heroku/check-ruby-version-for-production-app.md
Normal file
32
heroku/check-ruby-version-for-production-app.md
Normal file
@@ -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.
|
||||||
Reference in New Issue
Block a user