Can I install Ruby on Rails 2.x and Ruby on Rails 3 side by side

后端 未结 2 457
失恋的感觉
失恋的感觉 2020-12-29 14:21

I have a Ubuntu rails enviroment for playing around with ROR. Right now I am running Rails 2.3.8.

I want to look into rails 3. Is it possible to run both dev enviro

相关标签:
2条回答
  • 2020-12-29 14:51

    For Windows users:

    (I realize the asker uses Ubuntu, but this came up in the SERPs when I had a Windows-related question.)

    You'll find that rvm isn't an option. You can use pik, however:

    -- install the gem    
    > gem install pik
    
    -- run 'install' command to add the utility to your system
    > pik_install [some dir in your PATH variable]
    
    -- tell pik where your Ruby versions are
    > pik add C:\Ruby187\bin
    > pik add C:\Ruby193\bin
    
    -- see which versions pik has under control and which one is actively being used
    > pik list
    * 187: ruby 1.8.7 (2011-06-30 patchlevel 352) [i386-mingw32]
      193: ruby 1.9.3p194 (2012-04-20) [i386-mingw32]
    
    -- tell pik to use a different version
    > pik use 193
    > pik list
      187: ruby 1.8.7 (2011-06-30 patchlevel 352) [i386-mingw32]
    * 193: ruby 1.9.3p194 (2012-04-20) [i386-mingw32]
    
    -- confirm the change worked:
    > ruby -v && rails -v
    ruby 1.9.3p194 (2012-04-20) [i386-mingw32]
    Rails 3.2.3
    
    0 讨论(0)
  • 2020-12-29 14:56

    I would highly recommend Ruby Version Manager (rvm) - see this railscast for more information. This allows you to easily manage different versions of Ruby on the same machine. I believe this should also enable you to keep the different versions of Rails separate from each other, and allow you to switch between them easily - see this example from http://rvm.beginrescueend.com/gemsets/basics/ :

    rvm 1.9.2-head
    gem install rails -v 2.3.3
    
    rvm gemset create rails222 rails126
    Gemset 'rails222' created.
    Gemset 'rails126' created.
    
    rvm 1.9.2-head@rails222
    gem install rails -v 2.2.2
    
    rvm 1.9.2-head@rails126
    gem install rails -v 1.2.6
    

    Hope that helps!

    0 讨论(0)
提交回复
热议问题