Skip to content

eoecn/acts_as_time_racing

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Acts As Time Racing

Record one item's start and finish time

Usage

  1. Add started_at and finished_at datetime column to the table.
  2. Now here you go.
class LearnIssue < ActiveRecord::Base
  include ActsAsTimeRacing
end
1.9.3-p392 :001 > issue = LearnIssue.find(7)
  LearnIssue Load (0.5ms)  SELECT `learn_issue`.* FROM `learn_issue` WHERE `learn_issue`.`id` = 7 LIMIT 1
 => #<LearnIssue id: 7, started_at: "2013-05-14 04:54:41", finished_at: nil, > 
1.9.3-p392 :002 > issue.started_at
 => Tue, 14 May 2013 12:54:41 CST +08:00 
1.9.3-p392 :003 > issue.started?
 => true 
1.9.3-p392 :004 > issue.finished_at
 => nil 
1.9.3-p392 :005 > issue.finished?
 => false 

About

Record one item's start and finish time

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%