Class: Dst::Models::Task

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/dst/models.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.toggle!(task_id) ⇒ Object



29
30
31
32
33
# File 'lib/dst/models.rb', line 29

def self.toggle!(task_id)
  task = find(task_id)
  task.toggle!(:status)
  task
end

.unfinished(options = {}) ⇒ Object



25
26
27
# File 'lib/dst/models.rb', line 25

def self.unfinished(options={})
  find(:all, :conditions => 'status = "f"', :include => [:context, :project], :order => 't1_r1')
end

Instance Method Details

#statusObject



35
36
37
# File 'lib/dst/models.rb', line 35

def status
  read_attribute(:status) ? 'completed' : 'unfinished'  
end

#to_sObject



39
40
41
# File 'lib/dst/models.rb', line 39

def to_s
  "#{id} - #{context || ''}#{project || ''}#{description}"
end