Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save georgeu2000/034a8de58402ac33436aa1c967f4eac7 to your computer and use it in GitHub Desktop.
Save georgeu2000/034a8de58402ac33436aa1c967f4eac7 to your computer and use it in GitHub Desktop.
How to connect to Postgres DB with Active Record without Rails
db_config = YAML.load( ERB.new( File.read( "config/postgres.yml" )).result )
ActiveRecord::Base.establish_connection( db_config[ ENV[ 'RACK_ENV' ]])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment