1
votes

Can rails server be specified for the particular ruby version?

I'm on windows using gitbash and pik. I have ruby 192 and 193 installed via rubyinstaller. Pik is setup after much adding of .bashrc .pikrc and editing config.yml files. I can switch between rubies and gitbash sees the change. All appears to be well.

However, when running a simple test rails app, running rails server fails. Not an error but the welcome page is only plain text. The ruby is set to 193 but webrick reports 192 as noted on the second last line.

    laptop@LAPTOP-PC ~/Documents/Sites/rails_projects/demo_app (master)
    $ ruby -v
    ruby 1.9.3p0 (2011-10-30) [i386-mingw32]

    laptop@LAPTOP-PC ~/Documents/Sites/rails_projects/demo_app (master)
    $ rails server
    => Booting WEBrick
    => Rails 3.1.3 application starting in development on http://0.0.0.0:3000
    => Call with -d to detach
    => Ctrl-C to shutdown server
    [2011-12-07 19:08:18] INFO  WEBrick 1.3.1
    [2011-12-07 19:08:18] INFO  ruby 1.9.2 (2011-02-18) [i386-mingw32]
    [2011-12-07 19:08:19] INFO  WEBrick::HTTPServer#start: pid=1840 port=3000

How to set webrick to use 193? Any tips appreciated.

2
I don't think it is the path to ruby but the path to the rails executable that you should check. Are you sure that your path points to the rails executable under your ruby 1.9.3 installation?buruzaemon
Fixed. After chasing down blind alleys all I had to do was run bundle install again and that produces ruby 193 in rails server. As expected it ran quickly and did not have any lag like 192. Will set to Answer after 7 hour stackoverflow guideline.Walter Spicer
Good to know you solved the issue!buruzaemon

2 Answers

0
votes

as noted above, all I had to do was run bundle install again, and now webbrick server uses ruby 193

0
votes

If using Bundler 1.6, specify the Ruby version in Gemfile:

ruby '1.9.3'

You can specify the required version of Ruby in the Gemfile with ruby. If the Gemfile is loaded on a different Ruby version, Bundler will raise an exception with an explanation.

via http://bundler.io/v1.6/gemfile.html