4

I am pretty new to Ubuntu, Ruby, and Rails. I am working my way through the first Rails Guide. Midway through that guide, I upgraded Ubuntu version 11 to Ubuntu version 12. While I was on version 11, I installed Rails via:

gem install rails

and then ran:

rails --version

Which I'm almost sure output something along the lines of:

Rails 3.2.7

When I ran:

rails server

the Webrick server started, and I was able to view my getting started page. I was also able to continue with the tutorial a little ways. Then, I ran into some trouble with some missing/broken packages, and upgraded Ubuntu to version 12 in the process of trying to fix that issue.

Once I logged into Ubuntu version 12, I tried to continue with the tutorial. This time when I ran

rails server

This happened:

  create  
  create  app/controllers
  create  app/helpers
  create  app/models
  create  app/views/layouts
  create  config/environments
  create  config/initializers
  create  config/locales
  create  db
  create  doc
  create  lib
  create  lib/tasks
  create  log
  create  public/images
  create  public/javascripts
  create  public/stylesheets
  create  script/performance
  create  test/fixtures
  create  test/functional
  create  test/integration
  create  test/performance
  create  test/unit
  create  vendor
  create  vendor/plugins
  create  tmp/sessions
  create  tmp/sockets
  create  tmp/cache
  create  tmp/pids
  create  Rakefile
  create  README
  create  app/controllers/application_controller.rb
  create  app/helpers/application_helper.rb
  create  config/database.yml
  create  config/routes.rb
  create  config/locales/en.yml
  create  db/seeds.rb
  create  config/initializers/backtrace_silencers.rb
  create  config/initializers/inflections.rb
  create  config/initializers/mime_types.rb
  create  config/initializers/new_rails_defaults.rb
  create  config/initializers/session_store.rb
  create  config/initializers/cookie_verification_secret.rb
  create  config/environment.rb
  create  config/boot.rb
  create  config/environments/production.rb
  create  config/environments/development.rb
  create  config/environments/test.rb
  create  script/about
  create  script/console
  create  script/dbconsole
  create  script/destroy
  create  script/generate
  create  script/runner
  create  script/server
  create  script/plugin
  create  script/performance/benchmarker
  create  script/performance/profiler
  create  test/test_helper.rb
  create  test/performance/browsing_test.rb
  create  public/404.html
  create  public/422.html
  create  public/500.html
  create  public/index.html
  create  public/favicon.ico
  create  public/robots.txt
  create  public/images/rails.png
  create  public/javascripts/prototype.js
  create  public/javascripts/effects.js
  create  public/javascripts/dragdrop.js
  create  public/javascripts/controls.js
  create  public/javascripts/application.js
  create  doc/README_FOR_APP
  create  log/server.log
  create  log/production.log
  create  log/development.log
  create  log/test.log
  create  vendor/rails

I tried researching what was happening, and it looked like a result of Rails being an older version. I ran this:

rails --version

..and got this:

Rails 2.3.14

I thought that maybe, somehow Rails got downgraded or something, so I ran this:

gem install rails

and got this:

Successfully installed rails-3.2.7
1 gem installed
Installing ri documentation for rails-3.2.7...
Installing RDoc documentation for rails-3.2.7...

I figured that it must be fixed, so I tried things that Rails 3 should be able to do again, and got the same result as before, so I ran this:

rails --version

and got this:

Rails 2.3.14

I ran through everything a few more times, and kept getting the same results. I've tried researching why this could be happening, and so far, I'm not coming up with anything. It looks like I can install Rails 3, but it doesn't change that Ubuntu 12 thinks that Rails 2 is installed. It also reacts as if Rails 2 is installed, and nothing seems to change that.

Why would Ubuntu think that Rails 2 was installed, if it's telling me that Rails 3 was just installed?

Some additional details:

  • I'm using Zsh Terminal.
  • I'm using sudo where I need to, even if I didn't write it here
  • I'm running Ubuntu in VMware Workstation 8
  • I'm running VMware Workstation 8 in Windows 7
  • I tried installing Ubuntu 12 in a brand new virtual machine, and I'm getting the same issue there.

1 Answer 1

2

Because you have one of the pre-built 2.3.14 rails packages from the repositories installed, in addition to Rails 3.2.7 installed via gem :-)

  • Somehow, you installed one of these packages directly or as a dependency:
    rails - MVC ruby based framework geared for web application development
    ruby-rails-2.3 - MVC ruby based framework geared for web application development
    
  • apt-cache show rails tells us that it is...Version: 2.3.14.1
  • Starting from scratch, the following steps successfully install 3.2.7 (boringly detailed log available):

    sudo apt-get install rubygems
    sudo gem install rails
    #...wait for a while...
    $ rails --version
    Rails 3.2.7
    
  • On your existing system, I recommend trying this to see if you can remove 2.3.14 and get 3.2.7 working as the default:

    sudo apt-get remove rails ruby-rails\*
    sudo apt-get autoremove
    sudo apt-get --reinstall install rubygems
    sudo gem install rails
    

6
  • 1
    Thank you for the help! Unfortunately, now when I enter rails --version, it outputs this: /usr/bin/rails: No such file or directory Jul 29, 2012 at 17:07
  • I tried to use cd usr/bin/rails, and the folder didn't exist. I created the folder, then unpacked the gem into it by using cd usr/bin/rails gem unpack rails, and then rails --version. It still told me that Rails was not installed. Then, I used gem install rails, and this time it did the full install again. When I entered rails --version this time, it output Rails 3.2.7. Maybe somehow my old rails gem install was corrupted? Jul 29, 2012 at 17:54
  • Hmm. Now, for some reason, I'm able to run rails --version and rails server in one terminal tab, but if I try to do anything with rails in another tab, it says: The program 'rails' is currently not installed. You can install it by typing: sudo apt-get install rails Jul 29, 2012 at 18:13
  • I should add that somewhere in the middle, I installed RVM and switched from Ruby 1.8 to version 1.9. Jul 29, 2012 at 18:20
  • It's looking to me like maybe the issue is having Ruby 1.8 as the default version. If I run RVM, and then use it to set Ruby to version 1.9, it can tell what version of Rails is installed. I'm trying out using this to make version 1.9 the default: rvm use 1.9.2 --default Jul 29, 2012 at 23:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .