Created
March 29, 2012 15:21
-
-
Save webmat/2238436 to your computer and use it in GitHub Desktop.
Tweak Postgresql config to your liking on Rails boot. Works on Heroku.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rails.configuration.after_initialize do | |
case ENV['DB_SPEED'] | |
when 'fast' | |
ActiveRecord::Base.connection.execute "update pg_settings set setting='off' where name = 'synchronous_commit';" | |
when 'safe' | |
ActiveRecord::Base.connection.execute "update pg_settings set setting='on' where name = 'synchronous_commit';" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment