Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gworley3/9843460 to your computer and use it in GitHub Desktop.
Save gworley3/9843460 to your computer and use it in GitHub Desktop.
DbCharmer - Getting Started - extend_active_record.rb
require 'db_charmer'
class ActiveRecord::Base
extend AdStage::Logger
include AdStage::Logger
db_magic :slaves => (SLAVE_DB_CONNECTIONS.empty? ? [connection] : SLAVE_DB_CONNECTIONS), :force_slave_reads => false
log(:warn, "no slave databases connected") if SLAVE_DB_CONNECTIONS.empty?
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment