Skip to content

Instantly share code, notes, and snippets.

@jacqui
Created February 10, 2010 22:01
Show Gist options
  • Save jacqui/300901 to your computer and use it in GitHub Desktop.
Save jacqui/300901 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'pp'
unless self.class.const_defined? "IRB_RC_HAS_LOADED"
begin # db connection helpers
def some_db
ActiveRecord::Base.establish_connection(:adapter => 'mysql', :username => 'root', :database => 'some_database')
end
def prod_db
ActiveRecord::Base.establish_connection(:adapter => 'mysql', :username => 'root', :database => 'app_production')
end
def dev_db
ActiveRecord::Base.establish_connection(:adapter => 'mysql', :username => 'root', :database => 'app_development')
end
def current_db
ActiveRecord::Base.connection.current_database
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment