Datamapper Timestamps

Posted by Peter
on Jul 18, 08
If you want your created_at, updated_at, created_on and updated_on fields automatically set in your Datamapper model, you need to require 'dm-timestamps' before.


require 'dm-timestamps'

class Asset
include DataMapper::Resource

property :id, Integer, :serial => true
property :created_at, DateTime
property :updated_at, DateTime
end

Comments

Leave a response

  1. Michael GuterlOct 26 08 @ 11:19AM
    For what it is worth, this example does not work. At least with dm-core and dm-timestamps 0.9.6.

    I filed a bug on lighthouse, you can find more information and a test case there.

    http://wm.lighthouseapp.com/projects/4819/tickets/614-dm-timestamps-doesnt-set-created_atcreated_on-when-no-other-properties-are-set
Comment