Skip to content

Instantly share code, notes, and snippets.

@buk buk/setup.rb
Created Aug 24, 2013

Embed
What would you like to do?
Mein Frage drehte sich um Zeile 15, aber seitdem ich das *rescue nil* da stehen habe, klappt der Verbindungsaufbau :-)
require 'pg'
require 'active_record'
connection_details = {
adapter: 'postgresql',
database: 'toner',
username: 'sebastian',
encoding: 'utf8',
pool: 5
}
# setup the database connection
ActiveRecord::Base.establish_connection(connection_details.merge({databse: 'postgres', schema_search_path: 'public'}))
# create a new toner database
ActiveRecord::Base.connection.create_database(connection_details.fetch(:database)) rescue nil
# establis a database connection
ActiveRecord::Base.establish_connection(connection_details)
# migrate ALL THE THINGS
ActiveRecord::Migrator.migrate("db/migrate/")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.