diff --git a/README b/README index 3f02741..a6cbd05 100644 --- a/README +++ b/README @@ -21,7 +21,7 @@ end To use this adapter you just have to install the plugin: -ruby script/plugin install git://github.com/mauricio/master_database_adapter.git +ruby script/plugin install git://github.com/mauricio/master_slave_adapter.git And then configure it at your database.yml file: diff --git a/lib/master_slave_adapter/adapter.rb b/lib/master_slave_adapter/adapter.rb index 972c85d..85c81ba 100644 --- a/lib/master_slave_adapter/adapter.rb +++ b/lib/master_slave_adapter/adapter.rb @@ -85,11 +85,15 @@ def test_connections class << self def with_master - enable_master - begin + if master_enabled? yield - ensure - disable_master + else + enable_master + begin + yield + ensure + disable_master + end end end