shusseina

shusseina

Agile Web Development with Rails 7: 'rails new demo' specifying the Rails version has no affect

@rubys

Created the demo app with the following command from page 102:

work>​​ ​​rails​​ ​​new​​ ​​demo​

Examined the installation with the following command from page 104:

​demo>​​ ​​bin/rails​​ ​​about​

Output indicated Rails 7.0.5:

About your application's environment
Rails version             7.0.5

So I deleted the demo directory and ran the command, specifying the version:

rails _7.0.4_ new demo

Command bin/rails about still reports Rails 7.0.5. However, the Gemfile indicates 7.0.4:

gem "rails", "~> 7.0.4"

I presume 7.0.4 vs 7.0.5 is not going to make much of a difference. However, it would be nice to understand what’s going here.

FYI, gem list rails --local output:

*** LOCAL GEMS ***

importmap-rails (1.1.6)
rails (7.0.5, 7.0.4)
rails-dom-testing (2.0.3)
rails-html-sanitizer (1.6.0)
sprockets-rails (3.4.2)
stimulus-rails (1.2.1)
turbo-rails (1.4.0)

Marked As Solved

edward-mb

edward-mb

This is how RubyGems Semantic Versioning with Pessimistic version constraint works

gem "rails", "~> 7.0.4" # means >= 7.0.4 and < 7.1

Semantic versioning boils down to:

  • PATCH 0.0.x level changes for implementation level detail changes, such as small bug fixes
  • MINOR 0.x.0 level changes for any backwards compatible API changes, such as new functionality/features
  • MAJOR x.0.0 level changes for backwards incompatible API changes, such as changes that will break existing users code if they update

If you use a version specifier like "~> 7.0.4" bundler will always pick the latest patch of the given version 7.0 of the gem.

Most of the version specifiers, like >= 1.0 , are self-explanatory. The specifier ~> has a special meaning, best shown by example. ~> 2.0.3 is identical to >= 2.0.3 and < 2.1 . ~> 2.1 is identical to >= 2.1 and < 3.0 . ~> 2.2.beta will match prerelease versions like 2.2.beta.12 . ~> 0 is identical to >= 0.0 and < 1.0 .

Also Liked

rubys

rubys

Author of Agile Web Development With Rails

I’ve added an explanation and suggested replacing the twiddle-wakka with an equals sign.

Where Next?

Popular Pragmatic Bookshelf topics Top

New
mikecargal
Title: Hands-on Rust: question about get_component (page 295) (feel free to respond. “You dug you’re own hole… good luck”) I have somet...
New
Mmm
Hi, build fails on: bracket-lib = “~0.8.1” when running on Mac Mini M1 Rust version 1.5.0: Compiling winit v0.22.2 error[E0308]: mi...
New
jeremyhuiskamp
Title: Web Development with Clojure, Third Edition, vB17.0 (p9) The create table guestbook syntax suggested doesn’t seem to be accepted ...
New
Chrichton
Dear Sophie. I tried to do the “Authorization” exercise and have two questions: When trying to plug in an email-service, I found the ...
New
adamwoolhether
When trying to generate the protobuf .go file, I receive this error: Unknown flag: --go_opt libprotoc 3.12.3 MacOS 11.3.1 Googling ...
New
AufHe
I’m a newbie to Rails 7 and have hit an issue with the bin/Dev script mentioned on pages 112-113. Iteration A1 - Seeing the list of prod...
New
creminology
Skimming ahead, much of the following is explained in Chapter 3, but new readers (like me!) will hit a roadblock in Chapter 2 with their ...
New
andreheijstek
After running /bin/setup, the first error was: The foreman' command exists in these Ruby versions: That was easy to fix: gem install fore...
New
redconfetti
Docker-Machine became part of the Docker Toolbox, which was deprecated in 2020, long after Docker Desktop supported Docker Engine nativel...
New

Other popular topics Top

Exadra37
I am thinking in building or buy a desktop computer for programing, both professionally and on my free time, and my choice of OS is Linux...
New
New
AstonJ
I’ve been hearing quite a lot of comments relating to the sound of a keyboard, with one of the most desirable of these called ‘thock’, he...
New
Exadra37
On modern versions of macOS, you simply can’t power on your computer, launch a text editor or eBook reader, and write or read, without a ...
New
AstonJ
Inspired by this post from @Carter, which languages, frameworks or other tech or tools do you think is killing it right now? :upside_down...
New
AstonJ
This looks like a stunning keycap set :orange_heart: A LEGENDARY KEYBOARD LIVES ON When you bought an Apple Macintosh computer in the e...
New
AstonJ
If you want a quick and easy way to block any website on your Mac using Little Snitch simply… File &gt; New Rule: And select Deny, O...
New
New
First poster: bot
Large Language Models like ChatGPT say The Darnedest Things. The Errors They MakeWhy We Need to Document Them, and What We Have Decided ...
New
PragmaticBookshelf
A Ruby-Centric Chat with Noel Rappin @noelrappin Once you start noodling around with Ruby you quickly figure out, as Noel Rappi...
New

Latest in Agile Web Development with Rails 7

Agile Web Development with Rails 7 Portal

Sub Categories: