title: How to Downgrade from Ruby 1.9.2 to Ruby 1.8.7 to run Rails 2.0.2
body: <p>I want to downgrade the Ruby version I have installed(Ruby 1.9.2) on Ubuntu 10.04 OS so that I can use the appropriate version of Ruby 1.8.7 to run Rails 2.0.2. I am using the older version of Rails for project purpose.</p>
  
  <p>If I am using Rails 2.0.2 with Ruby 1.9.2 it gives me an error saying cant convert Enumerator into an array. </p>
  
  <p>I thought I could use rvm, but I am not sure if its suitable for downgrade.</p>
  
  <p>I get the following in the terminal when I use the command <strong>rvm list known</strong></p>
  
  <pre><code>mgj@pc146724-desktop:~$ rvm list known
  # MRI Rubies
  [ruby-]1.8.6[-p399]
  [ruby-]1.8.6-head
  [ruby-]1.8.7[-p302]
  [ruby-]1.8.7-head
  [ruby-]1.9.1-p243
  [ruby-]1.9.1[-p376]
  [ruby-]1.9.1-p429
  [ruby-]1.9.1-head
  [ruby-]1.9.2-preview1
  [ruby-]1.9.2-preview3
  [ruby-]1.9.2-rc1
  [ruby-]1.9.2-rc2
  [ruby-]1.9.2[-p0]
  [ruby-]1.9.2-head
  ruby-head
  
  # JRuby
  jruby-1.2.0
  jruby-1.3.1
  jruby-1.4.0
  jruby-1.5.1
  jruby-1.5.2
  /home/mohnish/.rvm/config/known 
  </code></pre>
  
  <p>I get the following in the list of installed ruby packages on using the command <strong>dpkg -l | grep ruby</strong></p>
  
  <pre><code>mgj@pc146724-desktop:~$ dpkg -l | grep ruby
  ii  libdbm-ruby                                4.2                                             DBM interface for Ruby
  ii  libdbm-ruby1.8                             1.8.7.249-2                                     DBM interface for Ruby 1.8
  ii  libgdbm-ruby                               4.2                                             GDBM interface for Ruby
  ii  libgdbm-ruby1.8                            1.8.7.249-2                                     GDBM interface for Ruby 1.8
  ii  libopenssl-ruby                            4.2                                             OpenSSL interface for Ruby
  ii  libopenssl-ruby1.8                         1.8.7.249-2                                     OpenSSL interface for Ruby 1.8
  ii  libreadline-ruby                           4.2                                             Readline interface for Ruby
  ii  libreadline-ruby1.8                        1.8.7.249-2                                     Readline interface for Ruby 1.8
  ii  libruby1.8                                 1.8.7.249-2                                     Libraries necessary to run Ruby 1.8
  ii  libtcltk-ruby                              4.2                                             Tcl/Tk interface for Ruby
  ii  libtcltk-ruby1.8                           1.8.7.249-2                                     Tcl/Tk interface for Ruby 1.8
  ii  rdoc                                       4.2                                             Generate documentation from ruby source file
  ii  ruby                                       4.2                                             An interpreter of object-oriented scripting 
  ii  ruby-elisp                                 4.2                                             Emacs-lisp ruby-mode for Ruby
  ii  ruby-full                                  4.2                                             Ruby full installation
  ii  ruby1.8                                    1.8.7.249-2                                     Interpreter of object-oriented scripting lan
  ii  ruby1.8-dev                                1.8.7.249-2                                     Header files for compiling extension modules
  ii  ruby1.8-elisp                              1.8.7.249-2                                     ruby-mode for Emacsen
  mgj@pc146724-desktop:~$ ^C
  </code></pre>
  
  <p>Do I need to uninstall Ruby 1.9.2 and only then freshly install Ruby 1.8.7 or can I switch versions?. If I can switch versions please direct me on how to set the path from Ruby 1.9.2 to Ruby 1.8.7. Or if there is some other way please let me know.</p>
  
  <p>If I have to uninstall Ruby 1.9.2 and then freshly install Ruby 1.8.7 please let me know how can I go about it. I tried the following commands to uninstall Ruby 1.9.2 but it didn't seem to find the Ruby 1.9.2 package.</p>
  
  <pre><code>sudo aptitude remove ruby
  
  sudo aptitude remove ruby 1.9.2p0
  
  sudo purge ruby
  
  sudo aptitude purge ruby 1.9.2p0
  </code></pre>
  
  <p>When I checked for the current version of Ruby installed it shows:</p>
  
  <pre><code>mgj@pc146724-desktop:~/Downloads/rubygems_postextract/rubygems-1.4.1$ ruby -v
  ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]
  
  mgj@pc146724-desktop:~/Downloads/rubygems_postextract/rubygems-1.4.1$ which ruby
  /home/mgj/.rvm/rubies/ruby-1.9.2-p0/bin/ruby
  </code></pre>
  
  <p>Thanks for your help..!!</p>