Monthly Archives: October 2009

Rails: Unpacking your gems into vendor/gems

Okay you have your marvelous gem but want to put it into the vendor directly.

No worries. In this example I will be working with the “marc (0.3.0)” gem.

  1. Edit the environment.rb file and under the “ do |config|” put the following line: config.gem ‘marc’
  2. Next “rake gems:unpack GEM=marc” where GEM=gem_name – don’t worry about the version number.

All done. You should have a new directory under vendor/gems/gem_name.

Troubleshooting. If this doesn’t quite work, you might want to try:

  • Create the gems directory under vendor yourself
  • It may complain that it lacks the specification file. If so go to the vendor/gems/gem_name directory and run: gem specification gem_name > .specification

If this still doesn’t work … then google or bing yourself to death.

Viewing RDoc for installed gems

Pretty simple:

gem server

It’s then available on localhost:8808

Pretty cool. It’s like having available doc for JAR files. Sort of.

Metaprogramming in Ruby is awesome

Well I had to override the behaviour of the Oracle Enhanced Adapter when creating sequence names. By default it creates them as “tablename_seq” where our database was “sq_tablename”.

After reading this post. I made my change and placed it under the config/initializers directory.

But the concept of metaprogramming in Ruby is really intriguing.

Netbeans Ruby Oracle OCI Mac Problem

Okay. You are using netbeans and connecting to Oracle. You have installed the Oracle Instant Client and have set the DYLD_LIBRARY_PATH=’/instantclient’ in your shell. All is well if you run your rails app from the command line.


But when you run it through Netbeans you get the error telling you to some effect:

“ERROR: ActiveRecord oracle_enhanced adapter could not load ruby-oci8 library. Please install ruby-oci8 library or gem.”

The explanation is that for some reason Netbeans on the mac does not pick up the settings set say in your .bashrc file. The easiest solution is to add the line:

“source ~/.bashrc” to your netbeans startup script.

Now Netbeans will pick up all your paths.