can't start script/console with Ruby 1.9 and Rails 2.3.4
I'm trying to start the console (irb) in Ruby 1.9 with Rails 2.3.4. I have two versions installed of Ruby (1.9 & 1.8.6) and I run the Ruby 1.9 by calling: rake19, ruby19, gem19...etc
And they work fine in all situations except this! it seems that its trying to load Ruby 1.8 instead! Do you know how I can change that?
Macintosh-10:favquote tammam56$ ruby19 script/console
Loading development environment (Rails 2.3.4)
/Users/tammam56/rubydev/favquote/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:1:in `require': no such file to load -- rubygems (LoadError)
from /Users/tamma开发者_如何转开发m56/rubydev/favquote/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:1
from /Users/tammam56/rubydev/favquote/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:1:in `require'
from /Users/tammam56/rubydev/favquote/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:1
from /Users/tammam56/rubydev/favquote/config/../vendor/rails/railties/lib/initializer.rb:10:in `require'
from /Users/tammam56/rubydev/favquote/config/../vendor/rails/railties/lib/initializer.rb:10
from /Users/tammam56/rubydev/favquote/config/boot.rb:45:in `require'
from /Users/tammam56/rubydev/favquote/config/boot.rb:45:in `load_initializer'
from /Users/tammam56/rubydev/favquote/config/boot.rb:38:in `run'
from /Users/tammam56/rubydev/favquote/config/boot.rb:11:in `boot!'
from /Users/tammam56/rubydev/favquote/config/boot.rb:110
from /Users/tammam56/rubydev/favquote/config/environment.rb:8:in `require'
from /Users/tammam56/rubydev/favquote/config/environment.rb:8
from /opt/local/lib/ruby/1.8/irb/init.rb:252:in `require'
from /opt/local/lib/ruby/1.8/irb/init.rb:252:in `load_modules'
from /opt/local/lib/ruby/1.8/irb/init.rb:250:in `each'
from /opt/local/lib/ruby/1.8/irb/init.rb:250:in `load_modules'
from /opt/local/lib/ruby/1.8/irb/init.rb:21:in `setup'
from /opt/local/lib/ruby/1.8/irb.rb:54:in `start'
from /opt/local/bin/irb:13
Thanks,
Tam
This is happening because script/console is calling irb (1.8). Assuming you have irb19 for ruby 1.9 you could do:
script/console --irb='irb19'
However there may still be problems with rails gems. If so, I'd recommend using rvm to manage your different rubys. When using rvm you will need to install gems separately for ruby 1.9 and 1.8.
精彩评论