gpt4 book ai didi

ruby-on-rails - rails : How does the console decide which Ruby version to use?

转载 作者:太空宇宙 更新时间:2023-11-03 16:50:39 24 4
gpt4 key购买 nike

我对在我的机器上使用的 Ruby 版本有点困惑 - 有人可以解释为什么 Rails 控制台正在(或看起来)使用不同版本的 Ruby (2.1.0) 比下面的其余命令返回 (2.1.1)?

$ bundle exec rails c
Loading development environment (Rails 4.1.0.rc2)
2.1.0 :001 >

=> 2.1.0

$ ruby -v
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]

=> 2.1.1

$ which ruby
/usr/local/rvm/rubies/ruby-2.1.1/bin/ruby

=> 2.1.1

$ rvm list

rvm rubies

=* ruby-2.1.1 [ x86_64 ]

# => - current
# =* - current && default
# * - default

=> 2.1.1

编辑:

$ rvm info

ruby-2.1.1@rails410rc2:

system:
uname: "Linux [...] 3.11.0-18-generic #32-Ubuntu SMP Tue Feb 18 21:11:14 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux"
system: "ubuntu/13.10/x86_64"
bash: "/bin/bash => GNU bash, version 4.2.45(1)-release (x86_64-pc-linux-gnu)"
zsh: " => not installed"

rvm:
version: "rvm 1.25.22 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "7 days 9 hours 8 minutes 49 seconds ago"
path: "/usr/local/rvm"

ruby:
interpreter: "ruby"
version: "2.1.1p76"
date: "2014-02-24"
platform: "x86_64-linux"
patchlevel: "2014-02-24 revision 45161"
full_version: "ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]"

homes:
gem: "/usr/local/rvm/gems/ruby-2.1.1@rails410rc2"
ruby: "/usr/local/rvm/rubies/ruby-2.1.1"

binaries:
ruby: "/usr/local/rvm/rubies/ruby-2.1.1/bin/ruby"
irb: "/usr/local/rvm/rubies/ruby-2.1.1/bin/irb"
gem: "/usr/local/rvm/rubies/ruby-2.1.1/bin/gem"
rake: "/usr/local/rvm/rubies/ruby-2.1.1/bin/rake"

environment:
PATH: "/usr/local/rvm/gems/ruby-2.1.1@rails410rc2/bin:/usr/local/rvm/gems/ruby-2.1.1@global/bin:/usr/local/rvm/rubies/ruby-2.1.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/rvm/bin"
GEM_HOME: "/usr/local/rvm/gems/ruby-2.1.1@rails410rc2"
GEM_PATH: "/usr/local/rvm/gems/ruby-2.1.1@rails410rc2:/usr/local/rvm/gems/ruby-2.1.1@global"
MY_RUBY_HOME: "/usr/local/rvm/rubies/ruby-2.1.1"
IRBRC: "/usr/local/rvm/rubies/ruby-2.1.1/.irbrc"
RUBYOPT: ""
gemset: "rails410rc2"

最佳答案

由于 RUBY_VERSION 返回 2.1.1,您使用的是 Ruby 2.1.1。可能 irb 提示以某种方式修补,返回 2.1.0 而不是 2.1.1,我猜是 RVM。它应该被打补丁,因为标准的 irb 提示应该是这样的

irb(main):001:0>

关于ruby-on-rails - rails : How does the console decide which Ruby version to use?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22918897/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com