Skip to content

Instantly share code, notes, and snippets.

@javm
Forked from dandemeyere/config.rb
Created November 2, 2012 04:49
Show Gist options
  • Save javm/3998770 to your computer and use it in GitHub Desktop.
Save javm/3998770 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