Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Rails3 postgresql support broken

#3959

A database.yml entry such as:

development:
adapter: postgresql host: localhost port: 5432 username: test password: changeme database: test_dev

raises the error:

$ ruby script/rails s => Booting WEBrick => Rails 3.0.0.beta application starting in development on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server Exiting
c:/Ruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in <br/> establish_connection': Please install the postgresql adapter:gem install activerecord-postgresql-adapter(no such file to load -- pg)<br/> (RuntimeError)

    from c:/Ruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta/lib/active_record/connection_adapters/abstract/connection_specificati

on.rb:60:in establish_connection'<br/>

    from c:/Ruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta/lib/active_record/connection_adapters/abstract/connection_specificati

on.rb:55:in establish_connection'<br/>

    from c:/Ruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta/lib/active_record/railtie.rb:45
    from c:/Ruby/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/initializable.rb:25:in `instance_exec'
    from c:/Ruby/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/initializable.rb:25:in `run'
    from c:/Ruby/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/initializable.rb:55:in `run_initializers'
    from c:/Ruby/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/initializable.rb:54:in `each'
    from c:/Ruby/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/initializable.rb:54:in `run_initializers'
    from c:/Ruby/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/application.rb:71:in `initialize!'
    from c:/Ruby/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/application.rb:41:in `send'
    from c:/Ruby/lib/ruby/gems/1.8/gems/railties-3.0.0.beta/lib/rails/application.rb:41:in `method_missing'
    from c:/rails/nemesisdivine/config/environment.rb:5
    from c:/Ruby/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:167:in `require'
    from c:/Ruby/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:167:in `require'
    from c:/Ruby/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:537:in `new_constants_in'
    from c:/Ruby/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:167:in `require'
    from config.ru:3
    from c:/Ruby/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/builder.rb:46:in `instance_eval'
    from c:/Ruby/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/builder.rb:46:in `initialize'
    from config.ru:1:in `new'
    from config.ru:1

$ gem list --local

LOCAL GEMS

abstract (1.0.0)
actionmailer (3.0.0.beta, 2.3.4)
actionpack (3.0.0.beta, 2.3.4)
activemodel (3.0.0.beta)
activerecord (3.0.0.beta, 2.3.4)
activeresource (3.0.0.beta, 2.3.4)
activesupport (3.0.0.beta, 2.3.5, 2.3.4)
arel (0.2.pre)
builder (2.1.2)
bundler (0.9.5, 0.9.3)
cgi_multipart_eof_fix (2.5.0)
erubis (2.6.5)
fastthread (1.0.1)
gem_plugin (0.2.3)
i18n (0.3.3)
linecache (0.43)
mail (2.1.2)
memcache-client (1.7.8)
mime-types (1.16)
mongrel (1.1.5)
mysql (2.8.1, 2.7.3)
pg (0.8.0)
postgres-pr (0.6.3)
rack (1.1.0, 1.0.1)
rack-mount (0.5.0, 0.4.0)
rack-test (0.5.3)
rails (3.0.0.beta, 2.3.4)
railties (3.0.0.beta)
rake (0.8.7)
ruby-debug-base (0.10.3)
ruby-debug-ide (0.4.5)
sqlite3-ruby (1.2.5)
text-format (1.0.0)
text-hyphen (1.0.0)
thor (0.13.1, 0.13.0)
tzinfo (0.3.16)

I have Rails 2.3.4 apps that have no problem with postgres access using the same gems.

Reported by Greg Donald · February 14th, 2010 @ 11:51 PM

State: resolved
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. Nikolay Petrachkov
    Nikolay Petrachkov

    tried rails 3 with postgres. It works on ruby ee 1.8.7 2009.10. You have to bundle pg gem. Just add gem "pg" to file Gemfile and then bundle install.
    On ruby 1.9.1 it gives me an error when i'm trying to start server:

    jx@jxkubuntu812:~/projects/topscore$ ./script/rails server
    => Booting WEBrick
    => Rails 3.0.0.beta application starting in development on http://0.0.0.0:3000
    => Call with -d to detach
    => Ctrl-C to shutdown server
    Exiting
    /home/jx/projects/topscore/.bundle/environment.rb:143:in `block in patch_rubygems': undefined method `name=' for   #<Gem::LoadError:0x989d00c> (NoMethodError)
    from /home/jx/.bundle/ruby/1.8/gems/activerecord-3.0.0.beta/lib/active_record/connection_adapters/abstract/connection_specification.rb:70:in `establish_connection'
    from /home/jx/.bundle/ruby/1.8/gems/activerecord-3.0.0.beta/lib/active_record/connection_adapters/abstract/connection_specification.rb:60:in `establish_connection'
    from /home/jx/.bundle/ruby/1.8/gems/activerecord-3.0.0.beta/lib/active_record/connection_adapters/abstract/connection_specification.rb:55:in `establish_connection'
    from /home/jx/.bundle/ruby/1.8/gems/activerecord-3.0.0.beta/lib/active_record/railtie.rb:45:in `block in <class:Railtie>'
    from /home/jx/.bundle/ruby/1.8/gems/railties-3.0.0.beta/lib/rails/initializable.rb:25:in `instance_exec'
    from /home/jx/.bundle/ruby/1.8/gems/railties-3.0.0.beta/lib/rails/initializable.rb:25:in `run'
    from /home/jx/.bundle/ruby/1.8/gems/railties-3.0.0.beta/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /home/jx/.bundle/ruby/1.8/gems/railties-3.0.0.beta/lib/rails/initializable.rb:54:in `each'
    from /home/jx/.bundle/ruby/1.8/gems/railties-3.0.0.beta/lib/rails/initializable.rb:54:in `run_initializers'
    from /home/jx/.bundle/ruby/1.8/gems/railties-3.0.0.beta/lib/rails/application.rb:71:in `initialize!'
    from /home/jx/.bundle/ruby/1.8/gems/railties-3.0.0.beta/lib/rails/application.rb:41:in `method_missing'
    from /home/jx/projects/topscore/config/environment.rb:5:in `<top (required)>'
    from /home/jx/.bundle/ruby/1.8/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:167:in `require'
    from /home/jx/.bundle/ruby/1.8/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:167:in `block in require'
    from /home/jx/.bundle/ruby/1.8/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:537:in `new_constants_in'
    from /home/jx/.bundle/ruby/1.8/gems/activesupport-3.0.0.beta/lib/active_support/dependencies.rb:167:in `require'
    from config.ru:3:in `block in <main>'
    from /home/jx/.rvm/gems/ree/1.8.7/gems/rack-1.1.0/lib/rack/builder.rb:46:in `instance_eval'
    from /home/jx/.rvm/gems/ree/1.8.7/gems/rack-1.1.0/lib/rack/builder.rb:46:in `initialize'
    from config.ru:1:in `new'
    from config.ru:1:in `<main>'
    from /home/jx/.rvm/gems/ree/1.8.7/gems/rack-1.1.0/lib/rack/builder.rb:35:in `eval'
    from /home/jx/.rvm/gems/ree/1.8.7/gems/rack-1.1.0/lib/rack/builder.rb:35:in `parse_file'
    from /home/jx/.rvm/gems/ree/1.8.7/gems/rack-1.1.0/lib/rack/server.rb:113:in `app'
    from /home/jx/.rvm/gems/ree/1.8.7/gems/rack-1.1.0/lib/rack/server.rb:189:in `wrapped_app'
    from /home/jx/.rvm/gems/ree/1.8.7/gems/rack-1.1.0/lib/rack/server.rb:155:in `start'
    from /home/jx/.bundle/ruby/1.8/gems/railties-3.0.0.beta/lib/rails/commands/server.rb:49:in `start'
    from /home/jx/.rvm/gems/ree/1.8.7/gems/rack-1.1.0/lib/rack/server.rb:83:in `start'
    from /home/jx/.bundle/ruby/1.8/gems/railties-3.0.0.beta/lib/rails/commands.rb:39:in `<top (required)>'
    from ./script/rails:10:in `require'
    from ./script/rails:10:in `<main>'
    jx@jxkubuntu812:~/projects/topscore$ ruby -v
    ruby 1.9.1p243 (2009-07-16 revision 24175) [i686-linux]
    jx@jxkubuntu812:~/projects/topscore$ bundle show
    Gems included by the bundle:
    
    • abstract (1.0.0)
    • actionmailer (3.0.0.beta)
    • actionpack (3.0.0.beta)
    • activemodel (3.0.0.beta)
    • activerecord (3.0.0.beta)
    • activeresource (3.0.0.beta)
    • activesupport (3.0.0.beta)
    • arel (0.2.1)
    • builder (2.1.2)
    • bundler (0.9.5)
    • erubis (2.6.5)
    • i18n (0.3.3)
    • mail (2.1.2)
    • memcache-client (1.7.8)
    • mime-types (1.16)
    • pg (0.8.0)
    • rack (1.1.0)
    • rack-mount (0.4.7)
    • rack-test (0.5.3)
    • rails (3.0.0.beta)
    • railties (3.0.0.beta)
    • rake (0.8.7)
    • sqlite3-ruby (1.2.5)
    • text-format (1.0.0)
    • text-hyphen (1.0.0)
    • thor (0.13.1)
    • tzinfo (0.3.16)

    February 15th, 2010 @ 10:38 AM

  2. Nikolay Petrachkov
    Nikolay Petrachkov

    btw, commenting gem rails and uncommenting gem rails git helps too:

    #gem "rails", "3.0.0.beta"
    
    ## Bundle edge rails:
    gem "rails", :git => "git://github.com/rails/rails.git"
    

    works on ruby 1.9.1

    February 15th, 2010 @ 11:07 AM

  3. Ryan Bigg
    Ryan Bigg
    • State changed from new to resolved

    Must bundle the pg gem.

    May 25th, 2010 @ 10:18 AM