Connecting to postgres with rails was no big deal. rails -d postgresql app_name, setup the database.yml and voila. I cannot, however, use postgres with just a little test script
I’ve tried installing the gems postgres, dbi & dbd-pg, pg, and ruby-pg, but with pg/ruby-pg and postgres it fails at the require for require ‘postgres’ or require ‘pg’. With require ‘dbi’ I get past the require, but it can’t load the driver….so how is rails doing it with the same set of packages? In fact I removed all the afore mentioned and found I only needed the ‘pg’ gem for everything to work fine with rails. Any advice?
Are you remembering to add a
require 'rubygems'to your source, or invokerubywith a-rubygemsargument, or addRUBYOPT=rubygemsto your environment? You need to do one of those to actually load the gem machinery that allowsrequireto find your gems.