Created
August 24, 2013 13:13
-
-
Save buk/6328074 to your computer and use it in GitHub Desktop.
Mein Frage drehte sich um Zeile 15, aber seitdem ich das *rescue nil* da stehen habe, klappt der Verbindungsaufbau :-)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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