Reputation: 122
so I've heard that ruby on rails 5 was out so I decided to upgrade my rails version. I can't figure out the way to use rails 5:
# My current Ruby version
$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
# My current Rails version
$ rails -v
Rails 4.2.6
When I run gem install rails
, it installs the latest version of rails(5.0.0)
$ gem install rails
Password:
Successfully installed rails-5.0.0
Parsing documentation for rails-5.0.0
Done installing documentation for rails after 0 seconds
1 gem installed
And now if I run
$ gem list -l
*** LOCAL GEMS ***
actioncable (5.0.0, 5.0.0.beta2)
actionmailer (5.0.0, 5.0.0.beta2)
actionpack (5.0.0, 5.0.0.beta2)
actionview (5.0.0, 5.0.0.beta2)
activejob (5.0.0, 5.0.0.beta2)
activemodel (5.0.0, 5.0.0.beta2)
activerecord (5.0.0, 5.0.0.beta2)
activesupport (5.0.0, 5.0.0.beta2)
arel (7.1.1)
bigdecimal (default: 1.2.8)
builder (3.2.2)
bundler (1.12.5)
concurrent-ruby (1.0.2)
did_you_mean (1.0.0)
erubis (2.7.0)
globalid (0.3.7)
i18n (0.7.0)
io-console (default: 0.4.5)
json (default: 1.8.3)
loofah (2.0.3)
mail (2.6.4)
method_source (0.8.2)
mime-types (3.1)
mime-types-data (3.2016.0521)
mini_portile2 (2.1.0)
minitest (5.8.3)
net-telnet (0.1.1)
nio4r (1.2.1)
nokogiri (1.6.8)
pkg-config (1.1.7)
power_assert (0.2.6)
psych (default: 2.0.17)
rack (2.0.1)
rack-test (0.6.3)
rails (5.0.0, 5.0.0.beta2)
rails-deprecated_sanitizer (1.0.3)
rails-dom-testing (2.0.1, 1.0.7)
rails-html-sanitizer (1.0.3)
railties (5.0.0, 5.0.0.beta2)
rake (10.4.2)
rdoc (default: 4.2.1)
rubygems-update (2.6.6)
sprockets (3.7.0)
sprockets-rails (3.1.1)
test-unit (3.1.5)
thor (0.19.1)
thread_safe (0.3.5)
tzinfo (1.2.2)
websocket-driver (0.6.4)
websocket-extensions (0.1.2)
It show that my rails version is now 5.0.0. But if I run
$ rails -v
Rails 4.2.6
I'm still using rails 4.2.6. How can I switch version?
Upvotes: 0
Views: 466
Reputation: 36
Run this:
# To change your ruby version as global
$ rbenv global <ruby version>
$ rbenv rehash
Upvotes: 1
Reputation: 429
Try running:
$ rbenv rehash
This should be run when you install a new gem that includes an executable (e.g. rails). If you install the gem rbenv-rehash by Ryan Souza, it can do this for you automatically.
Upvotes: 4