Skip to content

Instantly share code, notes, and snippets.

@dandemeyere
Created November 11, 2011 00:42
Show Gist options
  • Save dandemeyere/1356765 to your computer and use it in GitHub Desktop.
Save dandemeyere/1356765 to your computer and use it in GitHub Desktop.
ActiveRecord DB Setup File
require 'sinatra'
env = ENV["RACK_ENV"]
YAML::load(File.open('config/database.yml'))[env].symbolize_keys.each do |key, value|
set key, value
end
ActiveRecord::Base.establish_connection(
adapter: "mysql2",
host: settings.db_host,
database: settings.db_name,
username: settings.db_username,
password: settings.db_password)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment