Finding the answer to the question above in Stackoverflow. I always came across a similar, but not equal question: is it possible to create a new rails application with an old version than the last one installed on my computer (one of the most popular messages of this type ? Specifying the rails version to use when creating a new application ). However , what I am interested in is to know whether it is possible to run a command like "rails __2.1.0__ new myapp" even if this particular version of rails is not already installed on my computer so that when it starts , it automatically installs this version of rails plus creates all the source files (in which the Gemfile contains all the compatible stones of this particular version).
As an example ... Right now, I'm following Michael Hartle's Rails Tutorial book, and we will be asked to use ruby version 2.0.0, rails version 4.0.8 and include the following information in the Gemfile:
source 'https://rubygems.org' ruby '2.0.0'
It happens that by default I am ruby-2.1.2 and rails 4.1.4 by default, so when I wanted to follow the Hartl book, I had to create a new rails application (which installs the Gemfile in accordance with rails 4.1.4), and after that I had cd in a new application , run $ gem install rails -version 4.0.8 to install the version, replace the default Gemfile that comes with 4.1.4 rails for the above code , then run the installation package and install the update .
This seems to work, but overall it's a rather tedious and annoying solution. Could this not be solved, as I wrote at the beginning, with "rails ____ 2.1.0 ____, new myapps" in which version 2.1.0 is installed (which I did not install)?
I'm sure there should be an easier way to get started with another rails version project, I just can't find it or try to solve it with the wrong commands. I am sure that the solution I implemented was not good enough, because whenever I try to create another rails application using the version that I presumably already installed (2.0.0), this is what I get from the terminal:
Desktop$ rails _2.0.0_ new myapp /Users/gaa/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/dependency.rb:313:in `to_specs': Could not find 'railties' (= 2.0.0) - did find: [railties-4.1.4,railties-4.1.1] (Gem::LoadError) Checked in 'GEM_PATH=/Users/gaa/.rvm/gems/ruby-2.1.2:/Users/gaa/.rvm/gems/ ruby-2.1.2@global ', execute `gem env` for more information from /Users/gaa/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/dependency.rb:322:in `to_spec' from /Users/gaa/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_gem.rb:53:in `gem' from /Users/gaa/.rvm/gems/ruby-2.1.2/bin/rails:22:in `<main>' from /Users/gaa/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval' from /Users/gaa/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'
I am very grateful for the help.