Module | Sequel::Plugins::Timestamps
In: | lib/sequel/plugins/timestamps.rb

The timestamps plugin creates hooks that automatically set create and update timestamp fields. Both field names used are configurable, and you can also set whether to overwrite existing create timestamps (false by default), or whether to set the update timestamp when creating (also false by default).

### Methods

configure

### Classes and Modules

Module Sequel::Plugins::Timestamps::ClassMethods
Module Sequel::Plugins::Timestamps::InstanceMethods

### Public Class methods

configure(model, opts={})

Configure the plugin by setting the avialable options. Note that if this method is run more than once, previous settings are ignored, and it will just use the settings given or the default settings. Options:

- :create - The field to hold the create timestamp (default: :created_at)
- :force - Whether to overwrite an existing create timestamp (default: false)
- :update - The field to hold the update timestamp (default: :updated_at)
- :update_on_create - Whether to set the update timestamp to the create timestamp when creating (default: false)

[Source]

        # File lib/sequel/plugins/timestamps.rb, line 16
    16:       def self.configure(model, opts={})
    17:         model.instance_eval do
    18:           @create_timestamp_field = opts[:create]||:created_at
    19:           @update_timestamp_field = opts[:update]||:updated_at
    20:           @create_timestamp_overwrite = opts[:force]||false
    21:           @set_update_timestamp_on_create = opts[:update_on_create]||false
    22:         end
    23:       end

[Validate]