Created
October 18, 2010 15:06
-
-
Save veader/632350 to your computer and use it in GitHub Desktop.
This file contains 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
class ExternalDbModel < ActiveRecord::Base | |
self.abstract_class = true | |
establish_connection "external_#{RAILS_ENV}" | |
# only need this if you want the other db to be readonly | |
#private | |
# def after_initialize | |
# readonly! | |
# end | |
end | |
class InternalModel < ActiveRecord::Base | |
self.abstract_class = true | |
end | |
# this class points to the external DB | |
class SomeOutsideModel < ExternalDbModel | |
has_many :foos | |
end | |
# this class points to the internal DB | |
class SomeInsideModel < InternalModel | |
has_many :bars | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment