ActiveRecord driver for Postgresql with EventMachine
Latest commit 8d9b0d4 Jul 28, 2011 @mperham Merge pull request #2 from cjbottaro/master
Various fixes for fiber pool
Failed to load latest commit information.
test Add support for running in blocking mode, when used with rake db:migrate Apr 17, 2010
Rakefile Signal error to callback if we got an error message Apr 3, 2010


An EventMachine-aware driver for using Postgresql with ActiveRecord.


  • Ruby 1.9
  • EventMachine 0.12.10
  • postgres-pr 0.6.3
  • Rails 2.3.5

Tested with these version, other versions might work. YMMV.

You CANNOT have the pg gem installed. ActiveRecord prefers the pg gem but this code requires the postgres-pr gem to be loaded. I'm not sure if there is a way to make them live together in harmony.

You'll need to ensure your code is running within an active Fiber using the FiberPool defined in fiber_pool.rb. If you are running Rails in Thin, the following code is a good place to start to figure out how to do this:


List this gem in your config/environment.rb:

config.gem 'postgres-pr', :lib => false
config.gem 'em_postgresql', :lib => false

and update your config/database.yml to contain the proper adapter attribute:

adapter: em_postgresql


Mike Perham, mperham AT, Github, Twitter, Blog