Class: Geostats::Database

Inherits:
Object
  • Object
show all
Defined in:
lib/geostats/database.rb

Class Method Summary collapse

Class Method Details

.connect!(directory = nil) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/geostats/database.rb', line 3

def self.connect!(directory=nil)
  directory ||= File.expand_path("~/.geostats")

  file = File.join(directory, "database.sqlite3")
  raise "file does not exist: #{file}" unless File.exists?(file)

  ActiveRecord::Base.establish_connection(
    :adapter => "sqlite3",
    :database => file
  )
end