Michael Satterwhite wrote in post #969123:
> Philip Hallstrom wrote in post #969122:
>>>
>>> ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::PGconn
>> Try the 'pg' gem.
>
> I just installed it. Same result.
>
> I'm not sure my gem is installing correctly, though - or if there is
> something else needed. Note the following:
>
>    irb(main):001:0> require 'pg'
>    => true
>    irb(main):002:0> cn = PGconn.open(:dbname => 'movies')
>    NameError: uninitialized constant PGconn
>      from (irb):2

Actually ... are you using ruby 1.8.x ?

Is that line

  irb(main):001> require 'pg'

really your first line in the irb session ?

Should you not do

  require 'rubygems'

first ?  (IIRC, required in 1.8.x but no longer in 1.9.x)

My previous test was on ruby 1.9.2 and may have confused
both of us (sorry for that ...).

In ruby 1.8.7 (system ruby), I see this:

pet...@asus:~$ rvm use
Now using system ruby.  # which 1.8.7.249-2 on Ubuntu 10.04
pet...@asus:~$ gem list | grep pg
pg (0.10.0)
pet...@asus:~$ irb
irb(main):001:0> require 'pg' # should NOT work yet
LoadError: no such file to load -- pg
  from (irb):1:in `require'
  from (irb):1
  from :0
irb(main):002:0> require 'rubygems'
=> true
irb(main):003:0> require 'pg'
=> true
irb(main):004:0> Object.constants.grep(/PG/)
=> ["PGconn", "PGresult", "PGError"]

HTH,

Peter

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to