Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Blog
- @@options = { :adapter => "mysql2" }
- def self.options
- @@options
- end
- def initialize(options = Hash.new)
- @@options = {
- :adapter => "mysql2",
- :host => options[:host] || "localhost",
- :username => options[:user] || "root",
- :password => options[:pass] || "",
- :database => options[:db] || "my_blog"
- }
- end
- end
- module Foobar
- class Post < ActiveRecord::Base
- establish_connection(Blog.options)
- end
- end
- Blog.new(user:"foo",pass:"bar",db:"bang")
- p=Foobar::Post.all
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement