Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

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

Open
solnic opened this issue May 17, 2011 · 1 comment
Open

Comments

@solnic
Copy link
Contributor

solnic commented May 17, 2011

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
Copy link
Contributor Author

solnic commented May 17, 2011

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

by Dan Kubb (dkubb)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant