
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
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 like2.2.beta.12
.~> 0
is identical to>= 0.0
and< 1.0
.
Popular Prag Prog topics










Other popular topics









Latest in PragProg
Latest (all)
Categories:
Popular Portals
- /elixir
- /opensuse
- /rust
- /kotlin
- /ruby
- /erlang
- /python
- /clojure
- /react
- /quarkus
- /go
- /vapor
- /v
- /react-native
- /wasm
- /django
- /security
- /nodejs
- /centos
- /rails
- /haskell
- /fable
- /gleam
- /js
- /swift
- /deno
- /assemblyscript
- /tailwind
- /laravel
- /symfony
- /phoenix
- /crystal
- /typescript
- /debian
- /adonisjs
- /julia
- /arch-linux
- /svelte
- /spring
- /flutter
- /preact
- /c-plus-plus
- /actix
- /java
- /angular
- /ocaml
- /zig
- /kubuntu
- /scala
- /zotonic
- /vim
- /rocky
- /lisp
- /keyboards
- /html
- /vuejs
- /emacs
- /nim
- /nerves
- /elm