Created
March 28, 2014 21:35
-
-
Save gworley3/9843460 to your computer and use it in GitHub Desktop.
DbCharmer - Getting Started - extend_active_record.rb
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
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