OMG! Ruby and Rails

OMG part is not for awesomeness but how hard it was to fix a relatively simple issue when upgrading/installing latest version of Rails.

First I would like to point out how none-human-descriptive error trace is.
Then how every help site on internet keeps sending one issue to another on the same exact problem, yet no valid solutions.

What did I end up doing? IRC Channel. Problem turned out so simple and stupid that it’s almost embarrassing to write about it. Let’s go into it.

Installing Ruby, Rails

I am on Fedora 15, so keep in mind

By default using yum, fedora will install Ruby 1.8x. Which is not something you want to use, we’re going to install ruby 1.9.2p180 and Rails 3.1.0.rc4. You should read up on their site to see why it’s so cool. Lots of changes between 3.0 & 3.1 and I am glad am jumping into newest one.


RVM stands for Ruby Version Manager. What it does is packages everything individually for each version. Lifesaver, trust me! Plus you can install Ruby parts with it as ease as rvm install 1.9.2 to install the latest version of ruby.

Once you have RVM installed, then you gotta install RubyGems will will allow you to install any gem with ease, plus it has a cool site with all the gems. Once you got those installed, you’re ready for latest rails. To install run gem install rails --pre That’s it.
What –pre does is installs latest version (not stable), however with this one it’s already at RC4, so we’re good.

My Issue

Once I’ve got it all set up, I tried creating empty template by running rails new testapp, testapp is the name of the application. It spits something like this out.

hooker@secretgspot(~/Dropbox/websites/GIT)➜❱rails new testapp create create README create Rakefile create create .gitignore create Gemfile create app create app/assets/images/rails.png create app/assets/javascripts/application.js create app/assets/stylesheets/application.css create app/controllers/application_controller.rb create app/helpers/application_helper.rb create app/mailers create app/models create app/views/layouts/application.html.erb create app/mailers/.gitkeep create app/models/.gitkeep create config create config/routes.rb create config/application.rb create config/environment.rb create config/environments create config/environments/development.rb create config/environments/production.rb create config/environments/test.rb create config/initializers create config/initializers/backtrace_silencers.rb create config/initializers/inflections.rb create config/initializers/mime_types.rb create config/initializers/secret_token.rb create config/initializers/session_store.rb create config/initializers/wrap_parameters.rb create config/locales create config/locales/en.yml create config/boot.rb create config/database.yml create db create db/seeds.rb create doc create doc/README_FOR_APP create lib create lib/tasks create lib/tasks/.gitkeep create log create log/.gitkeep create public create public/404.html create public/422.html create public/500.html create public/favicon.ico create public/index.html create public/robots.txt create script create script/rails create test/fixtures create test/fixtures/.gitkeep create test/functional create test/functional/.gitkeep create test/integration create test/integration/.gitkeep create test/unit create test/unit/.gitkeep create test/performance/browsing_test.rb create test/test_helper.rb create tmp/cache create tmp/cache/.gitkeep create vendor/assets/stylesheets create vendor/assets/stylesheets/.gitkeep create vendor/plugins create vendor/plugins/.gitkeep run bundle installFetching source index for rake (0.9.2) Using multi_json (1.0.3) Using activesupport (3.1.0.rc4) Using bcrypt-ruby (2.1.4) Using builder (3.0.0) Using i18n (0.6.0) Using activemodel (3.1.0.rc4) Using erubis (2.7.0) Using rack (1.3.0) Using rack-cache (1.0.2) Using rack-mount (0.8.1) Using rack-test (0.6.0) Using hike (1.1.0) Using tilt (1.3.2) Using sprockets (2.0.0.beta.10) Using tzinfo (0.3.28) Using actionpack (3.1.0.rc4) Using mime-types (1.16) Using polyglot (0.3.1) Using treetop (1.4.9) Using mail (2.3.0) Using actionmailer (3.1.0.rc4) Using arel (2.1.1) Using activerecord (3.1.0.rc4) Using activeresource (3.1.0.rc4) Installing ansi (1.2.5) Using bundler (1.0.15) Installing coffee-script-source (1.1.1) Installing execjs (1.2.0) Installing coffee-script (2.2.0) Using rack-ssl (1.3.2) Using rdoc (3.6.1) Using thor (0.14.6) Using railties (3.1.0.rc4) Installing jquery-rails (1.0.11) Using rails (3.1.0.rc4) Installing sass (3.1.3) Installing sass-rails (3.1.0.rc.2) Installing sqlite3 (1.3.3) with native extensions Installing turn (0.8.2) Installing uglifier (0.5.4) Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

We cd into our new app by cd testapp, and run our server rails server
When everything goes well, we get something like this

(~/Dropbox/websites/GIT/testapp)➜❱rails s=> Booting WEBrick=> Rails 3.1.0.rc4 application starting in development on> Call with -d to detach=> Ctrl-C to shutdown server[2011-06-20 15:03:10] INFO WEBrick 1.3.1[2011-06-20 15:03:10] INFO ruby 1.9.2 (2011-02-18) [i686-linux][2011-06-20 15:03:10] INFO WEBrick::HTTPServer#start: pid=15678 port=3000

Well, in my case it start screaming about missing OPENSSL, what? I run yum install openssl, openssl-dev, anything that has to do with ruby and openssl in yum repository. Nothing! Still won’t start, still telling me

(~/Dropbox/websites/GIT/testapp)➜❱rails s=> Booting WEBrick=> Rails 3.1.0.rc4 application starting in development on> Call with -d to detach=> Ctrl-C to shutdown serverExiting/home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in `require': no such file to load -- openssl (LoadError) from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in `block in require' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in `block in load_dependency' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:639:in `new_constants_in' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in `load_dependency' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in `require' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/bcrypt-ruby-2.1.4/lib/bcrypt.rb:6:in `<top (required)>' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in `require' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in `block in require' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in `block in load_dependency' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:639:in `new_constants_in' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in `load_dependency' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:237:in `require' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activemodel-3.1.0.rc4/lib/active_model/secure_password.rb:1:in `<top (required)>' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activerecord-3.1.0.rc4/lib/active_record/base.rb:2120:in `block in <module:ActiveRecord>' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activerecord-3.1.0.rc4/lib/active_record/base.rb:2100:in `class_eval' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activerecord-3.1.0.rc4/lib/active_record/base.rb:2100:in `<module:ActiveRecord>' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activerecord-3.1.0.rc4/lib/active_record/base.rb:30:in `<top (required)>' from /home/hooker/Dropbox/websites/GIT/testapp/config/initializers/wrap_parameters.rb:11:in `<top (required)>' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:233:in `load' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:233:in `block in load' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in `block in load_dependency' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:639:in `new_constants_in' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:223:in `load_dependency' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activesupport-3.1.0.rc4/lib/active_support/dependencies.rb:233:in `load' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/railties-3.1.0.rc4/lib/rails/engine.rb:544:in `block (2 levels) in <class:Engine>' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/railties-3.1.0.rc4/lib/rails/engine.rb:543:in `each' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/railties-3.1.0.rc4/lib/rails/engine.rb:543:in `block in <class:Engine>' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/railties-3.1.0.rc4/lib/rails/initializable.rb:25:in `instance_exec' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/railties-3.1.0.rc4/lib/rails/initializable.rb:25:in `run' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/railties-3.1.0.rc4/lib/rails/initializable.rb:50:in `block in run_initializers' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/railties-3.1.0.rc4/lib/rails/initializable.rb:49:in `each' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/railties-3.1.0.rc4/lib/rails/initializable.rb:49:in `run_initializers' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/railties-3.1.0.rc4/lib/rails/application.rb:96:in `initialize!' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/railties-3.1.0.rc4/lib/rails/railtie/configurable.rb:30:in `method_missing' from /home/hooker/Dropbox/websites/GIT/testapp/config/environment.rb:5:in `<top (required)>' from /home/hooker/Dropbox/websites/GIT/testapp/ `require' from /home/hooker/Dropbox/websites/GIT/testapp/ `block in <main>' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/rack-1.3.0/lib/rack/builder.rb:51:in `instance_eval' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/rack-1.3.0/lib/rack/builder.rb:51:in `initialize' from /home/hooker/Dropbox/websites/GIT/testapp/ `new' from /home/hooker/Dropbox/websites/GIT/testapp/ `<main>' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/rack-1.3.0/lib/rack/builder.rb:40:in `eval' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/rack-1.3.0/lib/rack/builder.rb:40:in `parse_file' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/rack-1.3.0/lib/rack/server.rb:200:in `app' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/railties-3.1.0.rc4/lib/rails/commands/server.rb:46:in `app' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/rack-1.3.0/lib/rack/server.rb:301:in `wrapped_app' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/rack-1.3.0/lib/rack/server.rb:252:in `start' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/railties-3.1.0.rc4/lib/rails/commands/server.rb:70:in `start' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/railties-3.1.0.rc4/lib/rails/commands.rb:54:in `block in <top (required)>' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/railties-3.1.0.rc4/lib/rails/commands.rb:49:in `tap' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/railties-3.1.0.rc4/lib/rails/commands.rb:49:in `<top (required)>' from script/rails:6:in `require' from script/rails:6:in `<main>'

MAN! WTF?!?! So, I went out looking on RubyGems websites for openssl gems, maybe I am missing something. Obviously! installed all the gems that have word openssl in it. Nope, still not working.

That’s when I went to IRC, that’s my final straw after 3 days of headache.

IRC Solution

Lets check irb, no clue what it is, but lets check it anyways, guru from the channel knows what he is doing.

(~/Dropbox/websites/GIT/testapp)➜❱irbruby-1.9.2-p180 :001 > equire 'openssl'NoMethodError: undefined method `equire' for main:Object from (irb):1 from /home/hooker/.rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in `<main>'ruby-1.9.2-p180 :002 > require 'openssl'LoadError: no such file to load -- jopenssl from /home/hooker/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from /home/hooker/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from /home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31/gems/jruby-openssl-0.7.4/lib/openssl.rb:66:in `<top (required)>' from /home/hooker/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `require' from /home/hooker/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require' from /home/hooker/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require' from (irb):2 from /home/hooker/.rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in `<main>'

Hmmm, interesting, so it’s trying to load jopenssl instead of openssl. mmm.

Let’s remove your gemset and start clean. Okay, lets do it!

(~/Dropbox/websites/GIT)➜❱rvm gemset emptyWARN: Are you SURE you wish to remove the installed gemset for gemset 'ruby-1.9.2-p180@rails31' (/home/hooker/.rvm/gems/ruby-1.9.2-p180@rails31)?(anything other than 'yes' will cancel) > yes

Now, lets check for openssl again.

(~/Dropbox/websites/GIT)➜❱ruby -e 'require "openssl"'<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- openssl (LoadError) from <internal:lib/rubygems/custom_require>:29:in `require' from -e:1:in `<main>'

Looks like you don’t have openssl installed on your machine. I almost blew into RAGE! All the latest on my yum openssl.

(~/Dropbox/websites/GIT)➜❱sudo yum install openssl openssl-develLoaded plugins: fastestmirror, langpacks, presto, refresh-packagekitLoading mirror speeds from cached hostfile * fedora: * rpmfusion-free: * rpmfusion-free-updates: * rpmfusion-nonfree: * rpmfusion-nonfree-updates: * updates: up Install ProcessPackage openssl-1.0.0d-1.fc15.i686 already installed and latest versionPackage openssl-devel-1.0.0d-1.fc15.i686 already installed and latest versionNothing to do

At this point he asked me if I have tried installing openssl thru rvm ?!?!?!?!? WHHHHHHAAAAAT?
Yeah man, just run this:

(~/Dropbox/websites/GIT)➜❱rvm package install opensslFetching openssl-0.9.8n.tar.gz to /home/hooker/.rvm/archives % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed100 3681k 100 3681k 0 0 27540 0 0:02:16 0:02:16 --:--:-- 28217Extracting openssl-0.9.8n.tar.gz to /home/hooker/.rvm/srcConfiguring openssl in /home/hooker/.rvm/src/openssl-0.9.8n.Compiling openssl in /home/hooker/.rvm/src/openssl-0.9.8n.Installing openssl to /home/hooker/.rvm/usr

OO! I almost pulled the plug on my router.

Just be sure to reinstall ruby after this, so openssl goes into it’s configuration

(~/Dropbox/websites/GIT)➜❱rvm remove 1.9.2 && rvm install 1.9.2Removing /home/hooker/.rvm/src/ruby-1.9.2-p180...Removing default ruby interpreterRemoving /home/hooker/.rvm/rubies/ruby-1.9.2-p180...Removing ruby-1.9.2-p180 aliases...Removing ruby-1.9.2-p180 wrappers...Removing ruby-1.9.2-p180 environments...Removing ruby-1.9.2-p180 binaries...Installing Ruby from source to: /home/hooker/.rvm/rubies/ruby-1.9.2-p180, this may take a while depending on your cpu(s)...ruby-1.9.2-p180 - #fetching ruby-1.9.2-p180 - #downloading ruby-1.9.2-p180, this may take a while depending on your connection... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 29 8609k 29 2538k 0 0 8042 0 0:18:16 0:05:23 0:12:53 0^Z

some times later… 20-30min

ruby-1.9.2-p180 - #configuring ruby-1.9.2-p180 - #compiling ruby-1.9.2-p180 - #installing Removing old Rubygems files...Installing rubygems dedicated to ruby-1.9.2-p180...Installing rubygems for /home/hooker/.rvm/rubies/ruby-1.9.2-p180/bin/rubyInstallation of rubygems completed successfully.ruby-1.9.2-p180 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake).ruby-1.9.2-p180 - #importing default gemsets (/home/hooker/.rvm/gemsets/)Install of ruby-1.9.2-p180 - #complete 

Final Step

For finale, we recreate our testapp as explained in the begining, amongs other steps. Run rails s and get a beautiful result.

(~/Dropbox/websites/GIT/testapp)➜❱rails s
=> Booting WEBrick
=> Rails 3.1.0.rc4 application starting in development on
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-06-20 15:03:10] INFO WEBrick 1.3.1
[2011-06-20 15:03:10] INFO ruby 1.9.2 (2011-02-18) [i686-linux]
[2011-06-20 15:03:10] INFO WEBrick::HTTPServer#start: pid=15678 port=3000


Facebook Comments



I am a visual guy, I like pretty, simple, exotic things. Thus, I'll be talking mostly about CSS, HTML, UI, DESIGN stuff. For hardcore programmers, check out blog post from other team players at OSC.

Tagged with: , , , ,
Posted in post
One comment on “OMG! Ruby and Rails
  1. Hans Doller says:

    Followed your advice on a brand new Fedora 15 installation, but I encountered a few issues. Here’s the exact steps I took. Mind you I tried a lot of other commands, but these seems to be the most important ones.

    First, I installed Ruby 1.8.7 which is the default release for FC15. Then, I installed the gem for rvm:

    # yum install rubygem-rvm

    At this point, you should have an rvm binary and can probably uninstall the ruby installed by yum. I didn’t do this, and ended up with two versions of ruby.. 1.8.7 and 1.9.2.

    # yum remove ruby

    Then, for Fedora users, this step is crucial:

    # yum install zlib-devel

    Now you can install the “ree_dependencies” package from RVM. This gives you all the needed libraries for ruby + gems.

    # rvm package install ree_dependencies

    A few libraries will be downloaded + compiled. Once that’s ready, you need to include them in the build path of your ruby compilation. The build command I used was this:

    # rvm install 1.9.2 –default –bin /usr/local/sbin/ -C –with-readline-dir=$rvm_path/usr,–with-iconv-dir=$rvm_path/usr,–with-zlib-dir=$rvm_path/usr,–with-openssl-dir=$rvm_path/usrv

    ruby-1.9.2-p0 – #fetching
    ruby-1.9.2-p0 – #extracting ruby-1.9.2-p0 to /usr/local/rvm/src/ruby-1.9.2-p0
    ruby-1.9.2-p0 – #extracted to /usr/local/rvm/src/ruby-1.9.2-p0
    ruby-1.9.2-p0 – #configuring
    ruby-1.9.2-p0 – #compiling
    ruby-1.9.2-p0 – #installing
    ruby-1.9.2-p0 – updating #rubygems for /usr/local/rvm/gems/ruby-1.9.2-p0@global
    ruby-1.9.2-p0 – updating #rubygems for /usr/local/rvm/gems/ruby-1.9.2-p0
    ruby-1.9.2-p0 – adjusting #shebangs for (gem).
    ruby-1.9.2-p0 – #importing default gemsets (/usr/local/rvm/gemsets/)
    Install of ruby-1.9.2-p0 – #complete


    If you don’t do the “zlib-devel” step, you will probably get this error when trying to use gem utility:

    ERROR: Loading command: install (LoadError)
    no such file to load — zlib

Leave a Reply