Every time I close terminal rails defaults back to 2.3.5 from 3.0.3?

后端 未结 4 1634
再見小時候
再見小時候 2021-01-28 21:48

I\'m going through the rails by example tutorial.

Its seems that every time I close terminal rails defaults back to 2.3.5 & I have to go through the process of insta

相关标签:
4条回答
  • 2021-01-28 22:09

    @Ads If youre using RVM and you install rails using sudo like so

    $ [sudo] gem install rails --version 3.0.3
    

    youre doing it wrong. RVM depends on you using a ruby distro that was installed by RVM into your user directory. If youre using sudo, youre installing rails gem into your system-wide ruby.

    So check that youre using the right ruby version by doing 'rvm info' and then do your 'gem install rails --version 3.0.3' without sudo

    0 讨论(0)
  • 2021-01-28 22:26

    The problem is almost-assuredly RVM interpreting 2.3.5 as your default rails version in your default gem set. I ran into this problem myself when first experimenting with RVM. Try this:

    rvm --default use 1.9.2 (or whatever you want your default ruby interpreter to be)
    rvm gemset create rails-3.0.3
    rvm use 1.9.2@arails-3.0.3 --default
    gem install rails
    

    That will:

    • Set your default ruby interpreter to the desired ruby version
    • Create a gemset for your Rails 3.0.3 install and make it your default gemset
    • Install rails

    Once you close the terminal and open it back up, it'll load RVM's defaults, putting you back on Rails 3.0.3 again.

    0 讨论(0)
  • 2021-01-28 22:28

    Try uninstalling the rails gem:

    gem uninstall rails
    

    If you are prompted to select a version, select 2.3.5 and leave the 3.0.3 version intact.

    P.S: Are you using RVM? If not, I would highly recommend it.

    0 讨论(0)
  • 2021-01-28 22:28

    I've had this problem using RVM, if you're using RVM do: $rvm 1.9.2 (or whatever ruby version you installed the rails 3 gem with).

    Check the output of $ ruby -v when you seem to have access to rails3 and again $ ruby -v when you can only seem to get to v2.3.5. If it shows different versions of ruby then you most likley are using RVM.

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