Skip to content

Instantly share code, notes, and snippets.

@teich
Created September 7, 2010 18:16
Show Gist options
  • Save teich/568769 to your computer and use it in GitHub Desktop.
Save teich/568769 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