Skip to content

Instantly share code, notes, and snippets.

@Epictetus
Forked from teich/gist:568769
Created February 29, 2012 11:38
Show Gist options
  • Save Epictetus/1940234 to your computer and use it in GitHub Desktop.
Save Epictetus/1940234 to your computer and use it in GitHub Desktop.
module Core
def self.included(mod)
url = ENV['CORE_URL'] ? URI.parse(ENV['CORE_URL']) : URI.parse('postgres://postgres@localhost/heroku')
mod.establish_connection(
:adapter => "postgresql",
:host => url.host,
:username => url.userinfo.split(':')[0],
:password => url.userinfo.split(':')[1],
:database => url.path[1..-1]
)
end
def readonly?
true
end
def destroy
raise NoMethodError
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment