Module: Dst::Models

Included in:
Dst
Defined in:
lib/dst/models.rb

Defined Under Namespace

Classes: Context, Project, Task

Class Method Summary collapse

Class Method Details

.create_tables_if_necessary(force = false) ⇒ Object



16
17
18
# File 'lib/dst/models.rb', line 16

def create_tables_if_necessary(force=false)
  ActiveRecord::Schema.define(&Dst::Models.schema) if force || !Task.table_exists?
end

.establish_connection(options = {}) ⇒ Object



12
13
14
# File 'lib/dst/models.rb', line 12

def establish_connection(options={})
  ActiveRecord::Base.establish_connection({:adapter => 'sqlite3', :database => 'dst.db'}.merge(options))
end

.schema(&block) ⇒ Object



7
8
9
10
# File 'lib/dst/models.rb', line 7

def schema(&block)
  @@schema = block if block_given?
  @@schema
end