When you start the "rails server" how do you get the ruby ​​version as you see it with "ruby -v"?

I can't seem to get my ruby ​​version when starting the rails server so that it is the same as the one in the terminal. If I run commands like ruby -v

I get 1.9.3 which is the version I want to use. But I get 1.8.7 when I use rails server

. Any idea how I get my local server to use 1,9,3? I am using a Mac with Lion.


CHRISs-MacBook-Pro:test_app chrisrothstein$ rvm list

rvm rubies

=* ruby-1.9.3-p125 [ x86_64 ]

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

CHRISs-MacBook-Pro:test_app chrisrothstein$ ruby -v
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0]

CHRISs-MacBook-Pro:test_app chrisrothstein$ rails server
=> Booting WEBrick
=> Rails 3.2.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-04-07 15:48:50] INFO  WEBrick 1.3.1
[2012-04-07 15:48:50] INFO  ruby 1.8.7 (2010-01-10) [universal-darwin11.0]
[2012-04-07 15:48:50] INFO  WEBrick::HTTPServer#start: pid=53174 port=3000

      

+3


source to share


1 answer


If it's a Rails 3 app, you are using bundler by default. So, start your server in package context.

Do bundle install

if you haven't installed all the gems in yet Gemfile

. Start your server instead:



bundle exec rails s

      

This should cause the ruby ​​version to match what is shown in rvm.

+2


source







All Articles