From 16694cc133b2f65f912e312da59eb1eadb27105a Mon Sep 17 00:00:00 2001 From: Alexey Kovyrin Date: Sun, 16 Aug 2009 10:47:03 -0400 Subject: [PATCH] Documented connections management method --- .gitignore | 1 + README.rdoc | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5df5866 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/doc diff --git a/README.rdoc b/README.rdoc index 0741531..95b5bfa 100644 --- a/README.rdoc +++ b/README.rdoc @@ -11,7 +11,23 @@ == Easy ActiveRecord Connection Management -FIXME: To be added +As a part of this plugin we've added +switch_connection_to+ method that accepts many different kinds +of db connections and uses them on a model. We support: + +1. Strings and symbols as the names of connection configuration blocks in database.yml. +2. ActiveRecord models (we'd use connection currently set up on a model). +3. Database connections (Model.connection) +4. Nil values to reset model to default connection. + +Sample code: + + class Foo < ActiveRecord::Model; end + + Foo.switch_connection_to(:blah) + Foo.switch_connection_to('foo') + Foo.switch_connection_to(Bar) + Foo.switch_connection_to(Baz.connection) + Foo.switch_connection_to(nil) == DB Magic Method