Skip to content

Instantly share code, notes, and snippets.

@bpot
Forked from jotto/ar_multiple_db.rb
Created October 6, 2010 21:27
Show Gist options
  • Save bpot/614124 to your computer and use it in GitHub Desktop.
Save bpot/614124 to your computer and use it in GitHub Desktop.
class SkinnyJeanDb < ActiveRecord::Base
self.abstract_class = true
end
SkinnyJeanDb.establish_connection(:adapter => 'sqlite3', :database => @sqlite_db_path)
class Pageview < SkinnyJeanDb; end
Pageview.count
# any models inheriting from SkinnyJeanDb will use the proper connection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment