[英]Upgrading Ruby version And Rails Compatibility
Hi guys I wonder if someone could explain the problem I'm having so that I can understand whats going on. 嗨,大家好,我想知道是否有人可以解释我遇到的问题,以便我能理解最新情况。
I am currently running ruby 2.2.2 and rails 5. I have a small test app and all is working fine. 我目前正在运行ruby 2.2.2和rails 5.我有一个小测试应用程序,一切正常。 I decided to upgrade ruby to version 2.4.0, for no other reason than I think I should know how to do it and the resulting pitfalls etc, so a learning exercise.
我决定将ruby升级到版本2.4.0,除了我认为我应该知道如何做以及由此产生的陷阱等,没有其他原因,所以这是一个学习练习。
After updating ruby to 2.4.0 which goes fine the command rails -v
returns rails not installed. 将ruby更新到2.4.0之后,命令
rails -v
返回未安装的rails。 If i then revert to the older ruby 2.2.2 rvm use ruby-2.2.2
run rails -v
then rails 5.0.1 is returned. 如果我然后恢复到旧的ruby 2.2.2
rvm use ruby-2.2.2
运行rails -v
然后返回rails 5.0.1。 Whats happening here? 这里发生了什么事?
Thanks 谢谢
RVM gives you a separate gem directory for each and every Ruby version and gemset. RVM为每个Ruby版本和gemset提供单独的gem目录。 This means that gems must be explicitly installed for each revision and gemset.
这意味着必须为每个修订版和gemset显式安装gem。 Usually the migration process is as follows:
通常迁移过程如下:
rvm use ruby-2.4.0
# or `rvm --default use ruby-2.4.0` if you want to use 2.4.0 from now on
gem install rails -v 5.0.1 # an example, use any version you like
gem install bundler
bundle install # to install all other project gems
See the RVM gemsets documentation page . 请参阅RVM gemsets文档页面 。
Extending @Slava.K 's answer 扩展@ Slava.K的答案
I have a small test app and all is working fine.
我有一个小测试应用程序,一切正常。 I decided to upgrade ruby to version 2.4.0, for no other reason than I think I should know how to do it and the resulting pitfalls etc, so a learning exercise.
我决定将ruby升级到版本2.4.0,除了我认为我应该知道如何做以及由此产生的陷阱等,没有其他原因,所以这是一个学习练习。
rails
and bundler
. rails
和bundler
。 gem install rails -v xxx
and gem install bundler
. gem install rails -v xxx
和gem install bundler
。 rails -v
, this will print a version number of the installed rails for your given Ruby. rails -v
,这将打印给定Ruby的已安装rails的版本号。 After updating ruby to 2.4.0 which goes fine the command rails -v returns rails not installed.
将ruby更新到2.4.0之后,命令rails -v返回未安装的rails。 If i then revert to the older ruby 2.2.2 rvm use ruby-2.2.2 run rails -v then rails 5.0.1 is returned.
如果我然后恢复到旧的ruby 2.2.2 rvm使用ruby-2.2.2运行rails -v然后返回rails 5.0.1。 Whats happening here?
这里发生了什么事?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.