Methods

DataMapper::Timestamps::ClassMethods

Public Instance Methods

timestamps(*names) click to toggle source
    # File lib/dm-timestamps.rb, line 39
39:       def timestamps(*names)
40:         raise ArgumentError, 'You need to pass at least one argument' if names.empty?
41: 
42:         names.each do |name|
43:           case name
44:             when *TIMESTAMP_PROPERTIES.keys
45:               options = { :required => true }
46: 
47:               if Property.accepted_options.include?(:auto_validation)
48:                 options.update(:auto_validation => false)
49:               end
50: 
51:               property name, TIMESTAMP_PROPERTIES[name].first, options
52:             when :at
53:               timestamps(:created_at, :updated_at)
54:             when :on
55:               timestamps(:created_on, :updated_on)
56:             else
57:               raise InvalidTimestampName, "Invalid timestamp property name '#{name}'"
58:           end
59:         end
60:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.