DataMapper::Timestamps

Constants

TIMESTAMP_PROPERTIES

Public Class Methods

included(model) click to toggle source
    # File lib/dm-timestamps.rb, line 12
12:     def self.included(model)
13:       model.before :save, :set_timestamps_on_save
14:       model.extend ClassMethods
15:     end

Public Instance Methods

touch() click to toggle source

Saves the record with the updated_at/on attributes set to the current time.

    # File lib/dm-timestamps.rb, line 18
18:     def touch
19:       set_timestamps
20:       save
21:     end

Private Instance Methods

set_timestamps() click to toggle source
    # File lib/dm-timestamps.rb, line 30
30:     def set_timestamps
31:       TIMESTAMP_PROPERTIES.each do |name,(_type,proc)|
32:         if properties.named?(name)
33:           attribute_set(name, proc.call(self))
34:         end
35:       end
36:     end
set_timestamps_on_save() click to toggle source
    # File lib/dm-timestamps.rb, line 25
25:     def set_timestamps_on_save
26:       return unless dirty?
27:       set_timestamps
28:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.