无法升级到 rails 5
Can't upgrade to rails 5
所以我听说 rails 5 上的 ruby 已经出来了,所以我决定升级我的 rails 版本。我想不出使用方法 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
当我 运行 gem install rails
时,它会安装最新版本的 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
现在如果我 运行
$ 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)
显示我的rails版本现在是5.0.0。但是如果我 运行
$ rails -v
Rails 4.2.6
我仍在使用 rails 4.2.6。如何切换版本?
尝试 运行宁:
$ rbenv rehash
当您安装包含可执行文件(例如 rails)的新 gem 时,这应该是 运行。如果您安装 Ryan Souza 的 gem rbenv-rehash,它可以自动为您执行此操作。
运行这个:
# To change your ruby version as global
$ rbenv global <ruby version>
$ rbenv rehash
所以我听说 rails 5 上的 ruby 已经出来了,所以我决定升级我的 rails 版本。我想不出使用方法 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
当我 运行 gem install rails
时,它会安装最新版本的 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
现在如果我 运行
$ 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)
显示我的rails版本现在是5.0.0。但是如果我 运行
$ rails -v
Rails 4.2.6
我仍在使用 rails 4.2.6。如何切换版本?
尝试 运行宁:
$ rbenv rehash
当您安装包含可执行文件(例如 rails)的新 gem 时,这应该是 运行。如果您安装 Ryan Souza 的 gem rbenv-rehash,它可以自动为您执行此操作。
运行这个:
# To change your ruby version as global
$ rbenv global <ruby version>
$ rbenv rehash