Question

I'm a bit confused about the Ruby version that's being used on my machine - can somebody explain why the Rails console is (or appears to be) using a different version of Ruby (2.1.0) than the rest of the below commands return (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

EDIT:

$ 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"
Was it helpful?

Solution

Since RUBY_VERSION returns 2.1.1 you are using Ruby 2.1.1. Probably irb prompt is patched in some way that returns 2.1.0 instead of 2.1.1, I guess by RVM. It should be patched, since standard irb prompt should be something like

irb(main):001:0>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top