Skip to content

Instantly share code, notes, and snippets.

@everblut
Forked from thelinuxlich/puma.rb
Last active August 29, 2015 14:18
Show Gist options
  • Save everblut/17094b35e6f77c5540d6 to your computer and use it in GitHub Desktop.
Save everblut/17094b35e6f77c5540d6 to your computer and use it in GitHub Desktop.
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"]])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment