title: "pg" Ruby gem is throwing a "prepared statement already exists" error from Resque
body: <p>Apparently the <code>pg</code> gem uses <code>prepared statements</code> for Postgres. I have seen fixes for Unicorn to ensure that each process uses it's own db connection like so:</p>
  
  <pre><code>after_fork do |server, worker|
    ActiveRecord::Base.establish_connection
  end
  </code></pre>
  
  <p>But I have no idea how to make this work with Resque.</p>