Erik Hollensbe wrote:
>
> Unless rubygems has (recently) changed, the 'gem' command doesn't issue
> any requires, it just modifies the load path to point at your gem.
>
> I don't know if this is recommended usage anymore, but provided you
> haven't installed dbi with the provided setup.rb, "require 'dbi'" should
> work without the gem statements.
>
> -Erik
Hmmmm... that definitely does not work. When I say "require 'dbi'" it
returns true, but then dbh = DBI.connect('DBI:Mysql:money', 'mysqluser',
'pass3') causes an exception about DBI not being defined... I'm not on
my ruby box right now, so I cannot give the exact notation... basically,
what I show above works, the two gem commands and then the require.
In the pickaxe, pg 221 (2nd ed) it says I need to say
require 'rubygems'
require_gem '<gem_name>'
but rubygems appears to be required automatically when I start up, and
require_gem says that I should use 'gem' instead. So, if require
'rubygems' is not required (haha) and "require_gem" is just "gem", I'm
back to my original question, should I not be able to just say
gem 'dbi'
and, incidently, if I installed dbi using the gem installer, and you say
I should be able to "require 'dbi'" without the gem statements, why does
that not work? Do I have to do something special to get things that were
loaded as gems to be recognized differently than what I do for regular
packages?
--
Posted via
http://www.ruby-forum.com/.