[Ruby on Rails (RoR)] asdf install Ruby 3.x and Rails 7.0 on macOS
asdf, Ruby 3.x and Rails 7.0
Rails 7.0 has been years in the conceptual making. It’s the fulfillment of a vision to present a truly full-stack approach to web development that tackles both the front- and back-end challenges with equal vigor. An omakase menu that includes everything from the aperitif to the dessert.
And here are some of the many other new features and improvements:
-
At-Work Encryption With Active Record
Extracted from HEY, we’ve added encrypted attributes to Active Record, so your application can offer at-work encryption in addition to the traditional at-rest and in-transit coverage.
-
Trace Query Origins With Marginalia-Style Tagging
Almost a decade ago, Marginalia was extracted from Basecamp to trace query origins with SQL comment tagging. Now this external gem has been upstreamed into Active Record as QueryLogs.
-
Asynchronous Query Loading
When you have a controller action that needs to load two unrelated queries, you can now do it concurrently through Relation#load_async. If you have three complex queries that each take 100ms, you’d have to spend 300ms executing them one by one before. Now you can run them in parallel, spending only a total of 100ms on the set.
-
Zeitwerk Exclusively
Autoloading in Rails is one of those magical quality of life realities that it’s easy to just take for granted. The trusty old const_missing approach which came with a range of quirks and missing features has finally been replaced exclusively with the Zeitwerk code loader. There are a few upgrade gotchas to be aware of, especially for older applications, but with this upgrade guide you should be on your way in no time
-
A Few Other Highlights
-
***Spring` is no longer on by default, as faster computers have made it less relevant on anything but the largest applications.
-
ActionController::Live#send_stream
makes it easy to stream files that are being generated on-the-fly in controller actions. -
Parallelized testing will now compare your CPU core count to your test count and scale the parallelization accordingly.
-
Active Storage now uses the faster and more secure
libvips
as its default variant processor.
-
Prerequisites
-
The Xcode Command Line Tools Package is a small self-contained package available for download separately from Xcode and that allows you to do command line development in macOS which is consists of the macOS SDK and command-line tools such as Clang, which are installed at this
For more information about installing and using Xcode Command Line Tools, see the Xcode Command Line Tools
-
Homebrew is the Missing Package Manager for macOS (or Linux).
For more information about installing and using Homebrew, see the Homebrew - https://brew.sh/.
-
asdf is a tool version manager. All tool version definitions are contained within one file (.tool-versions) which you can check in to your project’s Git repository to share with your team, ensuring everyone is using the exact same versions of tools.
See Getting Started | asdf - https://asdf-vm.com/guide/getting-started.html#_1-install-dependencies to learn more.
-
Ruby plugin for asdf version manager.
See asdf-vm/asdf-ruby: Ruby plugin for asdf version manager - https://github.com/asdf-vm/asdf-ruby to learn more.
Install Ruby 3.0.3
1 | Optional |
Set Ruby version:
1 | Global |
Reshim Ruby version:
1 | asdf reshim ruby 3.0.3 |
Check Ruby version:
1 | ruby -v |
Install Rails
1 | Optional |
Check Rails version:
1 | rails -v |
FAQs
Calling DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call
DidYouMean.correct_error(error_name, spell_checker)’ instead. or Rails::Engine is abstract, you cannot instantiate it directly.
1 | ruby -v |
ruby 3.1.0p0
is not compatible with Rails 7.0.
See Rails cashes with Ruby 3.1.0 release · Issue #43998 · rails/rails - https://github.com/rails/rails/issues/43998 to learn more.
References
[3] Manage asdf - https://asdf-vm.com/#/core-manage-asdf
[4] asdf-vm/asdf-ruby: Ruby plugin for asdf version manager - https://github.com/asdf-vm/asdf-ruby
[7] Ruby Programming Language - https://www.ruby-lang.org/en/