datamapper / dm-timestamps

DataMapper plugin for magical timestamps
http://datamapper.org/
MIT License
9 stars 13 forks source link

dm-timestamps should serialise DateTime to higher accuracy/use Time #3

Open solnic opened 13 years ago

solnic commented 13 years ago

DataMapper dm-timestamps currently serialises DateTime to a 1s resolution, which is not precise enough to make specs than run at an acceptable speed. Currently I'm doing this to force a workaround:

   DataMapper::Timestamp::TIMESTAMP_PROPERTIES = { 
     :updated_at => [ Time, lambda { |r, p| Time.now } ], 
     :updated_on => [ Date, lambda { |r, p| Date.today } ], 
     :created_at => [ Time, lambda { |r, p| r.created_at || (Time.now if r.new_record?) } ], 
     :created_on => [ Date, lambda { |r, p| r.created_on || (Date.today if r.new_record?) } ], 
   }.freeze 

After a discussion on the mailing list[1], it appears some people may experience issues with this implementation. (It currently works fine for me.)

The current situation is that this ticket should be reviewed after the refactoring of DM::Property.

[1] http://groups.google.com/group/datamapper/browse_thread/thread/f1040627c7ec66c7


Created by Ashley Moran - 2009-06-29 21:01:25 UTC

Original Lighthouse ticket: http://datamapper.lighthouseapp.com/projects/20609/tickets/932

solnic commented 13 years ago

[project:id#20609 not-tagged:"0.10.0" not-tagged:"0.10.1" milestone:id#51895 bulk edit command]

by Dan Kubb (dkubb)