# I run these commands:
$ rvm current
ruby-2.3.3@rails500
$ gem list | grep '^rails '
rails (5.0.1, 5.0.0)
$ gem uninstall rails -v 5.0.1
Successfully uninstalled rails-5.0.1
$ gem uninstall railties -v 5.0.1
Successfully uninstalled railties-5.0.1
$ gem list | grep railties
railties (5.0.0)
$ rails -v
Rails 5.0.0
$ rails new . -m \
https://raw.github.com/RailsApps/rails-composer/master/composer.rb
# After I answer all the prompts, a Gemfile is created, which requires
# rails '~> 5.0.1'. After running to completion, Rails Composer leaves
# me with Rails 5.0.1:
$ rails -v
Rails 5.0.1
I didn't explicitly ask for Rails 5.0.1. Then why am I getting it? It appears to interfere with Rails Composer. See https://github.com/RailsApps/rails-composer/issues/261 and https://github.com/RailsApps/rails-composer/issues/260
You've observed a behavior of the Rails new
command. Rails Composer is a Rails application template and piggybacks on the Rails new
generator. The Rails new
command generates a simple default Rails application and then Rails Composer modifies it. The Gemfile generated by the Rails new
command contains gem 'rails', '~> 5.0.0'
. Note the "pessimistic versioning" specified by ~> 5.0.0
. It means use any version greater than 5.0.0 and less than 5.1 (any patch version can be used). When the Rails new
generator runs, it updates the gems, including the Rails gem, using the Gemfile provided by the simple default Rails application. Thus, the Rails 5.0.1 gem is installed before Rails Composer runs.
You can observe this behavior by running the Rails new
command without the Rails Composer application template.
myapp/2.4.0@rails500 $ rvm current
ruby-2.4.0@rails500
myapp/2.4.0@rails500 $ gem list | grep '^rails '
rails (5.0.0)
myapp/2.4.0@rails500 $ rails -v
Rails 5.0.0
myapp/2.4.0@rails500 $ rails new .
.
.
.
run bundle install
.
.
.
Installing rails 5.0.1
.
.
.
myapp/2.4.0@rails500 $ rails -v
Rails 5.0.1
In summary, your issue is with the Rails new
command, not with Rails Composer.