SapphireSteel Forum
Welcome, Guest. Please login or register.
May 20, 2013, 02:58:03 AM

Login with username, password and session length
Search:     Advanced search
Welcome to the SapphireSteel forum - for discussion of the Ruby In Steel and Amethyst IDEs
3883 Posts in 799 Topics by 669 Members
Latest Member: m
* Home Help Search Login Register
+  SapphireSteel Forum
|-+  General
| |-+  Ruby In Steel
| | |-+  Using correct ruby/rails version
« previous next »
Pages: [1] Print
Author Topic: Using correct ruby/rails version  (Read 1370 times)
dsmario
Registered User
Newbie
*
Posts: 7


« on: November 08, 2011, 09:21:17 AM »


I have two rails versions installed, 3.0.10 and 3.1.1

I have a Rails project open in VS 2010 using Ruby In Steel. In this project, it had Gemfile and it specified to use rails 3.0.10.

When I ran it using F5 command, the error came up on Ruby console saying:
   You have already activated activerecord 3.1.1, but your Gemfile requires activerecord 3.0.10. Using bundle exec may solve this. (Gem::LoadError)

If I have a separate command window in the project folder and run this:
   rails server -p 3000

I am able to see the website just fine.


How do I tell VS2010 project to read its Gemfile to use correct version 3.0.10 instead of 3.1.1?

Logged
Dermot
Administrator
Hero Member
*****
Posts: 1005


« Reply #1 on: November 08, 2011, 04:06:52 PM »

When you run Rails from RiS, the file webrick_service.rb is run (you can alter this in the project properties).

By default, the file looks like this:

Code:
require 'fileutils'
RAILS_ROOT = FileUtils::pwd()
puts "Running WEBrick service ..."
puts ("RAILS_ROOT: #{RAILS_ROOT}")
#require RAILS_ROOT + '/config/boot'
APP_PATH = RAILS_ROOT + '/config/application'
require 'rails/commands'

Try uncommenting the
Code:
#require RAILS_ROOT + '/config/boot'
line.

This is commented out because there was a problem in earlier versions of Rails and the 'boot' mechanism didn't work correctly from what I remember. You can replace the whole file if you want.

webrick_service.rb is in (for me) 'C:\ProgramData\SapphireSteel Software\Ruby In Steel 2010\Scripts'

Dermot

Logged
dsmario
Registered User
Newbie
*
Posts: 7


« Reply #2 on: November 09, 2011, 12:18:44 PM »

That works, thanks!
Logged
Dermot
Administrator
Hero Member
*****
Posts: 1005


« Reply #3 on: November 10, 2011, 02:38:38 PM »

That's good ...

I did a bit more exploration of what's going on:

1) leaving the 'boot' commented out stops the bundler running. However, this doesn't seem necessary most of the time and if you do have it running, you get a whole lot of 'whiny nils' being generated which I then had to turn off in 'development.rb'

2) with a basic rails installation, the bundler would not run because the interpreter could not find it.

3) However, there's a nice 'rails installer' we've just discovered from 'railsinstaller.org'. If you use this to install Rails, you get everything you need (without having to get the devkit) and it does it all for you. Also, it includes Ruby 1.9.2p290. With this installed, I uncommented the boot line and every thing worked fine (apart from the 'whiny nils' ).

So it looks like railsinstaller is the way to go.

Dermot
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!