Skip to content

Latest commit

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

= Multi-Database plugin for rails
by John Eberly
Use this plugin to have access to multiple databases in rails. I have not used this in a production environment yet. If you use this plugin, please drop me a note letting me know of your impressions, problems, etc.
= Installation
script/plugin install git://github.com/jeberly/multi_dbs.git
= Example Use
Here is a real life usage of the plugin for specifying a separate database for each model.
= Set database name for any model that does not use default specified in database.yml file
class Blog < ActiveRecord::Base
has_many :posts
end
class Post < ActiveRecord::Base
set_database_name "db2"
belongs_to :blog
end
The table blog must exist in your default database and table posts should exist in database "db2"
Now you can do this -> # Blog.first.posts
Currently it does not work with migrations, it assumed table 2..n are managed outside of rails. If you have a patch for this, let me know. :)

About

Specify multiple databases in a rails project.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages