Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Master/Slave delegation for ActiveRecord models for reads/writes

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README
Octocat-spinner-32 init.rb
README
ActiveDelegate
==============

Provides ActiveRecord with the ability to talk to multiple databases from a single model.

# app/models/master_database.rb
class MasterDatabase < ActiveRecord::Base
  handles_connection_for :master_database # <-- this matches the key from our database.yml
end

# app/models/animal.rb
class Animal < ActiveRecord::Base
  delegates_connection_to :master_database, :on => [:create, :save, :destroy]
end

TODO: Add more documentation
Something went wrong with that request. Please try again.