#932 suggestion
Ashley Moran

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

Reported by Ashley Moran | June 29th, 2009 @ 04:01 PM

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/f104...

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Pages