简体   繁体   中英

Why is rails installing a newer version when I run bundle?

I am trying to start a new rails project and I would like to stick with rails 3.1.3. However, when I run the command rails new projectname I get the following output:

  create  
  create  README.rdoc
  create  Rakefile
  create  config.ru
  create  .gitignore
  create  Gemfile
  create  app
  ...
  create  config
  ...
  create  config/database.yml
  create  db
  ...
  create  public/robots.txt
  create  script
  create  script/rails
  create  test/fixtures
  create  test/fixtures/.gitkeep
  ...
  create  tmp/cache
  create  tmp/cache/assets
  create  vendor/assets/javascripts
  ...
  create  vendor/plugins/.gitkeep
     run  bundle install
Fetching source index for https://rubygems.org/
Using rake (0.9.2.2) 
Using i18n (0.6.0) 
Using multi_json (1.0.4) 
Using activesupport (3.2.0.rc2) 
Using builder (3.0.0) 
Using activemodel (3.2.0.rc2) 
Using erubis (2.7.0) 
Using journey (1.0.0) 
Using rack (1.4.0) 
Using rack-cache (1.1) 
Using rack-test (0.6.1) 
Using hike (1.2.1) 
Using tilt (1.3.3) 
Using sprockets (2.1.2) 
Using actionpack (3.2.0.rc2) 
Using mime-types (1.17.2) 
Using polyglot (0.3.3) 
Using treetop (1.4.10) 
Using mail (2.3.0) 
Using actionmailer (3.2.0.rc2) 
Using arel (3.0.0) 
Using tzinfo (0.3.31) 
Using activerecord (3.2.0.rc2) 
Using activeresource (3.2.0.rc2) 
Using bundler (1.0.21) 
Using coffee-script-source (1.2.0) 
Using execjs (1.2.13) 
Using coffee-script (2.2.0) 
Using rack-ssl (1.3.2) 
Using json (1.6.5) 
Using rdoc (3.12) 
Using thor (0.14.6) 
Using railties (3.2.0.rc2) 
Using coffee-rails (3.2.1) 
Using jquery-rails (2.0.0) 
Installing rails (3.2.0.rc2)           # WTF?
Using sass (3.1.12) 
Using sass-rails (3.2.3) 
Using sqlite3 (1.3.5) 
Using uglifier (1.2.2) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

I'd like everything to remain version 3.1. Why does the rails command automatically update itself to 3.2.0.rc2? How can I make sure that everything I do is using 3.1.3 versions of everything?

Thanks.

It is relatively little known fact that you can specify the rails version for a new application _like.this_

rails _3.1.3_ projectname

will work assuming 3.1.3 is installed (gem install rails -v3.1.3 otherwise)

This also works with rails 2 apps, ie pre-bundler and will create a rails2 looking application in these cases, eg rails _2.3.8_ projectname Again gem install rails -v2.3.8 if necessary (ie first time usage on that machine).

Longer term make sure you are using rvm (now a defacto standard) and you can use that toset your default rails (as well as ruby).

Removing the old version can be done with sudo gem uninstall rails -v 3.2.0.rc2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM