Skip to content

Instantly share code, notes, and snippets.

@everblut
everblut / puma.rb
Last active August 29, 2015 14:18 — forked from thelinuxlich/puma.rb
threads 3, 3
workers 2
on_worker_boot do
require "active_record"
require "erb"
cwd = File.dirname(__FILE__)+"/.."
ActiveRecord::Base.connection.disconnect! rescue ActiveRecord::ConnectionNotEstablished
configuration = YAML.load(ERB.new(File.read("#{cwd}/config/database.yml")).result)
ActiveRecord::Base.establish_connection(configuration[ENV["RAILS_ENV"]])