On Wed, Aug 09, 2006, Michael S. wrote:
No I hadn’t; I never saw that construct before (hey! I’m still learning
I just did, and it works. This brings up some questions, which I’m
REALLY hoping that the experts here will educate me on.
Is the require ‘rubygems’ … the correct construct? Is it going to work
Yes, it’s correct. In order to include a gem, you have to include
rubygems. You don’t necessarily need to use require_gem (plain require
should work so long as you’ve already require’d rubygems) but it can be
helpful to remember what’s a gem and what isn’t.
As for rails, you shouldn’t need to include it explicitly. I’m not sure
exactly how it all works internally, but if your database.yml is set up
to use mysql, it will automatically require the gem. I believe that
Rails simply require’s whatever the adapter string is, but again, I’m
Is there a way to get the gem loaded with a simple “require ‘mysql’”?
Sure! Install it from source instead of as a gem
Alternately, you could go into wherever you have Ruby installed
and write a little wrapper in a mysql.rb file that simply requires
rubygems and mysql. I’m not really sure how that would work, though, as
I just tried it and it… didn’t.
Really, though, it’s not that bad to just require rubygems, is it?
I’m really trying to learn this so I don’t have to keep bugging the
people here. I also want to thank all of you for the help you’ve given.
I appreciate this community more than you know.
Everyone starts somewhere The Ruby community is the nicest I’ve ever
known. Bring your questions, they’re always welcome and someone will