class TaskLog < ActiveRecord::Base belongs_to :task def duration end_time - start_time end def active? start_time.not_nil? and end_time.nil? end end