Skip to content

Instantly share code, notes, and snippets.

@pedrocr
Created March 19, 2014 20:45
Show Gist options
  • Save pedrocr/9650800 to your computer and use it in GitHub Desktop.
Save pedrocr/9650800 to your computer and use it in GitHub Desktop.
Initializer to change the database
BASESPEC = {adapter: "sqlite3",
database: "db/production.sqlite3",
pool: 5,
timeout: 5000}
if Camerasink::BASEDIR
$stderr.puts "Starting the app on #{Camerasink::BASEDIR}"
dbfile = File.expand_path(BASESPEC[:database], Camerasink::BASEDIR)
ActiveRecord::Base.establish_connection BASESPEC.merge(database: dbfile)
ActiveRecord::Migrator.migrate("db/migrate/")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment