forked from manveru/ramaze
-
Notifications
You must be signed in to change notification settings - Fork 37
Using multiple databases
leucos edited this page Oct 14, 2012
·
2 revisions
This is well explained in this list post.
Just define constants containing your database connections :
BLOG_DB = Sequel.sqlite('data/blog/blog.db')
COMMENTS_DB = Sequel.sqlite('data/blog/comments.db')
Then, use self.db
to set the database connection to use in your model :
class Blog < Sequel::Model
self.db = BLOG_DB
...
end
class BlogComment < Sequel::Model
self.db = COMMENTS_DB
...
end
Alternatively, you can set the database connection like this :
class Blog < Sequel::Model(BLOG_DB)
...
end
class BlogComment < Sequel::Model(COMMENTS_DB)
...
end
- Website
- Google Groups
- User Guide
- [#ramaze on the Freenode network] (http://webchat.freenode.net/?channels=ramaze)