# 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 newcommand. Rails Composer is a Rails application template and piggybacks on theRails newgenerator. TheRails newcommand generates a simple default Rails application and then Rails Composer modifies it. The Gemfile generated by theRails newcommand containsgem '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 theRails newgenerator 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 newcommand 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.1In summary, your issue is with the Rails
newcommand, not with Rails Composer.