Update rails to a specific version
gem install rails --version=3.2.3
Or use bundler. Write in Gemfile:
gem 'rails', '3.2.3'
and execute in rails root directory
bundle install
How do I upgrade Rails?
If you are using RVM then you should create a seperate gemset first like:
rvm gemset create whateverName
in this example I will install rails 4
rvm install 2.0.0
rvm list
rvm 2.0.0
^^^^(you may need to copy and paste the version number exactly here as it was displayed in rvm list)
rvm gemset create rails4
rvm gemset use rails4
add the following to your gemfile for existing apps
gem 'rails', '4.0.0'
then run
bundle update rails
or do following to just install the gem
gem install rails --version=4.0
UPDATE
If you havne't installed Xcode 4.5 CLI tools then you will need to
Preferences > Downloads > Components
DMG
https://developer.apple.com/downloads
you may then also need to use homebrew to update gcc
brew install apple-gcc42
the following link has all the information you will need:
https://thoughtbot.com/blog/the-hitchhikers-guide-to-riding-a-mountain-lion
how update Rails ruby minor version
The specifier ~> has a special meaning, best shown by example. ~> 3.0 is identical to >= 3.0 and < 3.1. So all minor patches are included. See https://bundler.io/gemfile.html.
No need to change your Gemfile just install the gems in the newly installed Ruby version.
How do I upgrade rspec to a specific version in my Rails project?
Upgrade all gems that are mentioned and might collide with their required RSpec-version. The output tells you, that guard-rspec collides with a newer RSpec-version. Try with:
bundle update rspec rspec-rails guard-rspec
If then there is another error with new Gems, try adding those to the command, too. Transitive dependencies, that are not listed in your Gemfile are generally not required to list (rspec-mocks etc.).
Summary: Try upgrading all related offending Gems at once.
Also, as Les said, you are not supposed to update Gemfile.lock manually (except in case of Merge Conflicts), but only through bundle update [GEMNAME]
.
Deleting Gemfile.lock is a last resort, as you will lose your current, maybe well-functioning, dependency situation and upgrade all Gems at once to their newest version, as specified in the Gemfile.
ROR - How to update a rubygem to a particular version?
In your Gemfile specify the gem version. For example:
gem "foo", "= 1.0.0"
then run bundle update foo
How to switch to an older version of rails
First, uninstall the version of Rails you have:
gem uninstall rails
Next, install the version of Rails you want, like so:
gem install rails -v 3.1.12
There are a few ways to have both "installed" at the same time. As Joe Frambach suggested, you could install Rails 4 in a VM. You could also install RVM - the Ruby enVironment Manager - and use separate gemsets to keep the two versions of Rails apart. But if you are just learning you may not want to bother with this.
Edit: @Shadwell's answer got it right, although it could use some expansion, which I'll do here:
> rvm gemset create rails3
> rvm gemset use rails3
> gem install rails -v 3.1.12
> rails my_new_app
Specifying rails version to use when creating a new application
I found here an undocumented option to create a new application using an older version of Rails.
rails _2.1.0_ new myapp
Related Topics
How to Install and Use Slim Template Engine with Middleman
How to Get Ruby-Debug-Ide to Work
What Do I Need to Do to Get Hash.From_Xml() to Work
Converting Video to Flash and Mp4 Ruby on Rails
Unwanted Form Parameters Being Appended to Pagination Links
Using Rvm, But Can't Set Current Ruby Version (Ubuntu 11.10)
Ruby on Rails: Two References with Different Name to the Same Model
Nokogiri Recursively Get All Children
Add External Style Sheet in Rails Project
Error When Installing Ruby 2.1.3 with Rvm
How to Properly Test Cancan Abilities with Rspec
Rake: Logging Any Task Executing
Linux Cli: How to Render Arabic Text into Bitmap
Ruby No Implicit Conversion of Fixnum into String (Typeerror)
Ruby on Rails Collection Select - How to Pre-Select the Right Value