Problems using postgresql (postgres-pr) gem

I’ve trying to use the postgres-pr gem on CentOS/Ruby 1.9.2. When I
attempt to run Webrick (or rake update), I get an error saying that it
cannot find the gem “postgres.” I’m not sure why, because nowhere in
my Gemfile or database.yml do I refer to anything called “posgres.”

Any suggestions?

Postgres is confusing (to me). I install “pg (0.10.0)” and that is
working for me. I’m currently toying with Rails 3 using Ruby 1.9.2 but
I’ve done lots of Ruby 2 using Ruby 1.8 and 1.9.1.

If you use the --database=postgresql option when you create your
project, it will have this at the top:

PostgreSQL. Versions 7.4 and 8.x are supported.

Install the pg driver:

gem install pg

On Mac OS X with macports:

gem install pg –

–with-pg-config=/opt/local/lib/postgresql84/bin/pg_config

On Windows:

gem install pg

Choose the win32 build.

Install PostgreSQL and put its /bin directory on your path.

Good luck

I got the same error using the pr gem… Strange. There is some
dependency somewhere that I can’t find.

Is it possible that when you do “gem” you are using a different copy of
Ruby than if you run your rails application?

There is at least one requirement here:

activerecord-2.3.5/lib/active_record/connection_adapters/postgresql_adapter.rb

(replace 2.3.5 with your flavor of Rails)

begin
require_library_or_gem ‘pg’
rescue LoadError => e
begin
require_library_or_gem ‘postgres’
class PGresult
alias_method :nfields, :num_fields unless
self.method_defined?(:nfields)
alias_method :ntuples, :num_tuples unless
self.method_defined?(:ntuples)
alias_method :ftype, :type unless self.method_defined?(:ftype)
alias_method :cmd_tuples, :cmdtuples unless
self.method_defined?(:cmd_tuples)
end
rescue LoadError
raise e
end
end

Possible… Thanks for the suggestions. I’ll have to try that out.