I have a Rails app that I developed on Windows. Now I’m bringing it over to a VM to get it running there before I deploy it. First I ran rails c and got
/usr/share/ruby-rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `require': cannot load such file -- openssl (LoadError)
from /usr/share/ruby-rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:240:in `block in require'
OK I solved that with Rails 3 – no such file to load — openssl.
Then I ran rails c again and got:
/usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `load': /mnt/hgfs/AquaticKodiak/config/initializers/session_store.rb:3: syntax error, unexpected ':', expecting $end (SyntaxError)
...sion_store :cookie_store, key: '_mySiteName_session'
^
from /usr/lib/ruby/gems/1.8/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `load'
To me it looks like when it hit the first error Rails was using 1.9.3 and in the second one it was using 1.8. I’m pretty sure that key: 'siteName' won’t work in 1.8. Does this mean that one of my gems is a 1.8 gem? I’ve done a bundle install and a bundle update, that didn’t help.
Is Rails confused about which version of Ruby to use? When I run ruby -v I get ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]. That seems correct.
From the paths, it looks like you’re using RVM and Linux on your VM. Since you followed the instructions for the openssl problem I’m guessing you may have corrupted your environment variables, and therefore disabled RVM, hence falling back to system default 1.8.
Open a new terminal and see if you can still run RVM
rvm list. You should see a list of available ruby versions, if you don’t then your RVM environment variables are messed up and you need to fix them (see the RVM docs).Check in the project directory for the
.rvmrcfile and verify that you’re using a version of ruby that’s available on the system.If yo use a list of ruby versions from
rvm listselect the one you want to use and executervm use ruby-1.9.x-pxxxjust replace the x’s with the one you want. You can also set the default ruby version to use with RVM’sdefaultcommand. Again, see the RVM docs.