The current official version of Rails is 4.0.3.
When I create a new Rails app I get version 4.0.2, and then I have to update the Gemfile and run bundle update.
What should I do to have the latest version of Rails (and all other default gems) on my system, such that when creating a new app it automatically has the latest version?
If you run gem update it will update all installed rubygems. This includes rails and all gems on your system.
You should be careful though since you may not want to update everything. In that case you can specify gems individually.
gem update rails
To get the latest gems you can run
gem update
To simply see what gems can be updated you can run
gem outdated
To update just the rails gem you can do
gem update rails
Related
I'm on Rails 4.0.4.
I would like to try out the latest relase candidate for 4.1.
How would I upgrade my Rails application to the latest RC?
If a gem's version number has a letter in the version then it is considered to be 'pre-release' and will be skipped by bundler unless you specify otherwise in your Gemfile.
If you want to use a pre-release version of a gem:
# Gemfile
gem "rspec-rails", ">= 6.0.0-rc1", "< 6.1"
This will install 6.0.0-rc1 and then update to anything in the 6.0.x releases (I think this includes future pre-releases) using the RubyGems pessimistic version constraints.
Source
You can run bundle update to update all your gems at once.
If you just want to update a particular gem (such as rails) you can run bundle update rails.
I have the Rails 4.0.0.beta1 installed but I need downgrade to Rails 3.2.13.
I've used gem install rails 3.2 but Rails continues as 4.0.0.beta1.
I searched existing doubts and try to follow the answers however none worked for me.
Think this is a simple doubt and I need to solve.
This answer my question: How to set default rails version for a project?
You have the same problem as listed here.
Here is what worked for me, and should also for you. It's a more general solution that works regardless of your specific version of the Rails beta. Please note that in order to shift back to 3.2.13 (or whatever version you'd like to go back to), you must remove Railties as well as Rails.
Just do:
gem uninstall rails
Then, select the version of Rails 4 you have and delete it.
Then, do:
gem uninstall railties
And do the same thing.
When I uninstalled the Rails 4 version of railties, it told me that dependencies for a couple gems (coffee-rails and sass-rails) wouldn't be met. So I just did the same thing with both of them as I did above, and deleted their Rails 4 versions as well (for example, for sass-rails, I had a version installed called sass-rails-4.0.0.rc1).
And done! The terminal should list 3.2.13 as your current Rails version.
Unless you're using bundle exec, Rubygems will always use the latest installed version of a gem. You need to uninstall the version you don't want.
gem uninstall rails --version 4.0.0.beta1
The answers to gem uninstall rails --version xxx should remove the rails gem just fine.
However, in the event you want or need to have multiple versions of rails available simultaneously, you can use bundler to load the correct versions of gems (as intended).
$ bundle exec rails in the project directory that lists the version of rails in the Gemfile should let you load the required gems without conflict.
Additionally, rvm and its gemset feature could also let you accomplish the same goal without needing to wrap everything with a bundle exec
Rails will use the version specified in Gemfile:
gem "rails", "4.0.0.beta1"
Replace it with the version you'd like to use instead:
gem "rails", "~> 3.2.0"
Of course, you will also need to change your code and config to use the old Rails API.
I had the same problem with Rails 4.0.0 final version. To check what is currently installed you can run the following:
>pik gem list
Then I checked the rails versions. It showed rails 3.2.14 (what I wanted) with railties 4.0.0, 4.0.0.rc2 and 3.2.14.
I then ran
>gem uninstall railties
and uninstalled all other versions except 3.2.14 and now it works well. The problem was that when Rails 3.2 installation is called, the latest (or all) versions of railties is installed.
If you have other versions of rails other tan the one you want, you can removed them with
>gem uninstall rails
and remove the versions of rails you do not want to have.
Try the following in your console. It will update or install rails to the specified version.
gem update rails 3.2.13
In my Gemfile I have:
gem 'rails'
until yesterday it works well, my rails version was 3.2.9.
I've added no new gems and today, after running bundle update I see that it installs rails-0.9.5.
Why?
Running bundle update without specifying a gem to update is a bad idea if you haven't set the minor version in your Gemfile. The reason for this is because you will likely upgrade a gem that has a different public interface and it will break your application.
I'd recommend specifying the major and minor version of Rails in your Gemfile so that it "locks" it down so it will only upgrade the patch level:
gem "rails", "~> 3.2.9"
Then when you want to upgrade it, just run:
bundle update rails
This will update Rails to the latest patch (3.2.x) and as long as they are following semantic versioning, you won't have to worry about it breaking your app.
i have a project of rails with versions ruby 1.8.7, gems 1.3.6, rails 2.3.5
I want to update the project to the current version can you guys please give the picture how to update older rails applications to current version....
thank you..
RVM and Bundler with the use of a gemfile is helpful in the situation you are in.
RUBY Versioning
Install Ruby Version Manager (pay careful instructions to how to install)
Installation documentation for RVM is here https://rvm.io/rvm/install/
once installed download the version of RUBY you want to use
rvm install 1.9.3 or rvm install 1.8.7
afterwards type in RVM use 1.8.7 and it will set your system to use the older version
Gem Versioning
Apparently you can install the gems in rails 2 by using the rake command
enter in rake gems:install
Your code to config gems are located in the config/environment.rb
There is a helpful tool called "Bundler" which is a gem that easily lets you manage your gem version through the use of a file called a "gemfile". I think the link below is a good resource on how to upgrade your Rails 2 project
http://llamarada-cinetica.heroku.com/blog/2011/02/14/using-gemfiles-on-rails
with RVM and gem configuration you can upgrade gems as needed and check if it works with your build.
(others please correct me if i'm wrong I've only been on rails for a short while)
My suggestion is If your client want you to update the project you can update else extend the application features with older version of Rails because lots of features will break if you upgrade to new Rails version.
And your question is not suitable to ask in Stackoverflow.
I want to make a Rails Bundle Package for a client. I am using Rails 3.0.3 and Ruby 1.9.2. What is the process if I need to update the bundle package with new gem versions?
If you want to update to a specific version, use #Ferdy's answer, but if you just want to update to the most recent version run:
bundle update gem_name
This will update your gem to the latest version, and also update all of its dependencies. It will also update your Gemfile.lock file so that you can commit it to source code. Other systems will now just need to run:
bundle install
to get the update.
You want to update the gems used in a rails project? My guess is that you update the versions in the GemFile
gem 'name', 'version'
and then run bundle install.. This will install all the appropriate versions.