Skip to content

Instantly share code, notes, and snippets.

@thelinuxlich
Created September 4, 2014 23:13
Show Gist options
  • Save thelinuxlich/e095d45d8582d6a2c6e4 to your computer and use it in GitHub Desktop.
Save thelinuxlich/e095d45d8582d6a2c6e4 to your computer and use it in GitHub Desktop.
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"]])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment