1. Eric Radman
  2. ruby-pg-url

Source

ruby-pg-url /

Filename Size Date modified Message
1.2 KB
630 B
734 B
1.8 KB

Ruby-Pg-URL

This module allows a database connection using rugy-pg to be established using a URL.

Example

require 'pg'
require 'rubypgurl'

spec = RubyPgURL.parse(ENV['DATABASE_URL'] || raise("DATABASE_URL not set"))
conn = PG.connect(spec)

Installation

cp rubypgurl.rb $MYPROJECT/lib/

Supported Features

  • Standard postgresql:// URI syntax
  • Arbitrary parameters specified in the query string
  • Unix domain sockets with percent encoding (requires Ruby >= 2.2)