Skip to content

Instantly share code, notes, and snippets.

@webmat
Created March 29, 2012 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webmat/2238436 to your computer and use it in GitHub Desktop.
Save webmat/2238436 to your computer and use it in GitHub Desktop.
Tweak Postgresql config to your liking on Rails boot. Works on Heroku.
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