Module: ROM::Plugins::Command::Timestamps::ClassInterface

Defined in:
core/lib/rom/plugins/command/timestamps.rb

Instance Method Summary collapse

Instance Method Details

#datestamps(*names) ⇒ Object Also known as: datestamp

Set up attributes to datestamp when the command is called

Examples:

class CreateTask < ROM::Commands::Create[:sql]
  result :one
  use :timestamps
  datestamps :created_on, :updated_on
end

create_user = rom.command(:user).create.curry(name: 'Jane')

result = create_user.call
result[:created_at]  #=> Date.today

Parameters:

  • names (Array<Symbol>)

    A list of attribute names



139
140
141
# File 'core/lib/rom/plugins/command/timestamps.rb', line 139

def datestamps(*names)
  datestamp_columns datestamp_columns.merge(names)
end