Skip to content

Instantly share code, notes, and snippets.

@pol
Created February 10, 2009 18:28
Show Gist options
  • Select an option

  • Save pol/61519 to your computer and use it in GitHub Desktop.

Select an option

Save pol/61519 to your computer and use it in GitHub Desktop.
::: in your database.yml
# stuff common to several databases
login: &login
adapter: mysql
username: fad
password: fad
host: localhost
fad_2007:
<<: *login
database: fad_2007
development:
<<: *login
database: fad_development
test:
<<: *login
database: fad2_test
production:
<<: *login
database: fad2_production
# Exernal Database Connection, through SSL
grumpy:
adapter: mysql
host: grumpy.msu.montana.edu
username: some_username
password: a_delicious_password
database: external_datbase_name
sslca: /Users/mongrel/SSL/ca-cert.pem
sslkey: /Users/mongrel/SSL/client-key.pem
sslcert: /Users/mongrel/SSL/client-cert.pem
::: Then in your Model
class UdarCourse < ActiveRecord::Base
establish_connection :grumpy
# for some reason, setting table names explicitly on external connections
# resolved problems I was having.
set_table_name "udar_courses"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment