This project is archived and is in readonly mode.

#3959 ✓resolved
Greg Donald

Rails3 postgresql support broken

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

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.

Comments and changes to this ticket

  • Nikolay Petrachkov

    Nikolay Petrachkov February 15th, 2010 @ 10:38 AM

    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)
  • Nikolay Petrachkov

    Nikolay Petrachkov February 15th, 2010 @ 11:07 AM

    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

  • Ryan Bigg

    Ryan Bigg May 25th, 2010 @ 10:18 AM

    • State changed from “new” to “resolved”

    Must bundle the pg gem.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages