Hi guys (and ladies if any),
And now what? Do I have to smehow uninstall Rails for rbenv and install it for rvm, or can I just "replace" it??
What about the setting of older projects when switching to rvm? Do the projects need to be updatesd somehow (configuration etc.)?
Every Rails project has the version of Rails in the Gemfile that it will use separately from every other app. There's nothing you need to do to manage two different Rails versions.
The only thing you'll want to do is
gem install rails to get the latest version and create your new project with
rails new myapp. That will make sure the new project starts with Rails 5.1 (or whatever is the latest at the time).
You can also create apps with older versions of rails using
rails _4.2.0_ new myapp
Rbenv and Rvm have pretty much nothing to do with this because they are for Ruby versions, not Rails. All of this is taken care of by Bundler.
When you switch apps to work on the correct versions will be automatically used, no changes required by you.
But I have Rails 5.0.1 gem already installed. How can I install the newer gem version withou updating the old one?
Can I run multiple gem versions alongside each other?
You just run the commands like I said above. All your gems install side by side so you can always have more than one version installed.
Here's why that works, as I understand it: Bundler will take care of ensuring that only the gem versions specified in your Gemfile.lock are in Ruby's library load path.
rails _5.1.4_ new mynewapp
gem 'rails', '~> 5.1.4'
rails (5.1.6) actioncable (= 5.1.6) actionmailer (= 5.1.6) actionpack (= 5.1.6) actionview (= 5.1.6) activejob (= 5.1.6) activemodel (= 5.1.6) activerecord (= 5.1.6) activesupport (= 5.1.6) bundler (>= 1.3.0) railties (= 5.1.6) sprockets-rails (>= 2.0.0)
Join 22,346+ developers who get early access to new screencasts, articles, guides, updates, and more.