Home > Software engineering >  Rails 7.0.2.2 thinks it's 7.1
Rails 7.0.2.2 thinks it's 7.1

Time:03-01

MacOS Monterey
Ruby 3.1.0
npm v 8.4.1
yarn -v 1.22.17

There was no Rails on the system, and it had the system ruby installation.

I installed ruby through asdf. When I look into

~/..asdf/installs/ruby

I see:

 3.1.0

Then I did a rails 7.0.2.2 installation as follows:

gem install rails -v 7.0.2.2

It looked it went fine and the right gems were getting installed. The last statement was:

Successfully installed rails-7.0.2.2

Then I did the following:

 rails new myapp --database=mysql --skip-test --main --css=bootstrap   

Watching the install, the following did not make sense:

Using activesupport 7.1.0.alpha from https://github.com/rails/rails.git (at main@cece807)
Using activemodel 7.1.0.alpha from https://github.com/rails/rails.git (at main@cece807)
Using actionview 7.1.0.alpha from https://github.com/rails/rails.git (at main@cece807)
Using activejob 7.1.0.alpha from https://github.com/rails/rails.git (at main@cece807)
Using activerecord 7.1.0.alpha from https://github.com/rails/rails.git (at main@cece807)
Using actionpack 7.1.0.alpha from https://github.com/rails/rails.git (at main@cece807)
Using activestorage 7.1.0.alpha from https://github.com/rails/rails.git (at main@cece807)
Using railties 7.1.0.alpha from https://github.com/rails/rails.git (at main@cece807)
Using actioncable 7.1.0.alpha from https://github.com/rails/rails.git (at main@cece807)
Using actiontext 7.1.0.alpha from https://github.com/rails/rails.git (at main@cece807)
Using actionmailbox 7.1.0.alpha from https://github.com/rails/rails.git (at main@cece807)
Using actionmailer 7.1.0.alpha from https://github.com/rails/rails.git (at main@cece807)
Using rails 7.1.0.alpha from https://github.com/rails/rails.git (at main@cece807)

....

create  config/initializers/new_framework_defaults_7_1.rb
....
remove  config/initializers/new_framework_defaults_7_1.rb

Then when I opened up config/appliation.rb

I found this in it:

config.load_defaults 7.1

Any idea why this is happening? The rails 7.1.0(Alpha) does not even exist.

CodePudding user response:

Running rails new --help will show that passing the --main flag will:

Set up the application with Gemfile pointing to Rails repository main branch

And the current version on Github is 7.1.0.alpha

If you want to use 7.0.2.2, just remove the --main flag

  • Related