module DataMapper::Timestamps::ClassMethods
Public Instance Methods
timestamps(*names)
click to toggle source
# File lib/dm-timestamps.rb, line 39 def timestamps(*names) raise ArgumentError, 'You need to pass at least one argument' if names.empty? names.each do |name| case name when *TIMESTAMP_PROPERTIES.keys options = { :required => true } if Property.accepted_options.include?(:auto_validation) options.update(:auto_validation => false) end property name, TIMESTAMP_PROPERTIES[name].first, options when :at timestamps(:created_at, :updated_at) when :on timestamps(:created_on, :updated_on) else raise InvalidTimestampName, "Invalid timestamp property name '#{name}'" end end end