Module: DataMapper::Timestamps::ClassMethods

### Home Classes Methods

### In Files

- lib/dm-timestamps.rb

### Methods

- #timestamps

### Files

- LICENSE
- README.rdoc

### Class/Module Index

Quicksearch

- DataMapper
- DataMapper::Timestamp
- DataMapper::Timestamps
- DataMapper::Timestamps::ClassMethods
- DataMapper::Timestamps::InvalidTimestampName

No matching classes.

# 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

[Validate]

Generated with the Darkfish Rdoc Generator 2.