module ROM::Plugins::Command::Timestamps::ClassInterface

Public Instance Methods

datestamp(*names)
Alias for: datestamps
datestamps(*names) click to toggle source

Set up attributes to datestamp when the command is called

@example

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

@param [Array<Symbol>] names A list of attribute names

@api public

# File lib/rom/plugins/command/timestamps.rb, line 139
def datestamps(*names)
  datestamp_columns datestamp_columns.merge(names)
end
Also aliased as: datestamp
timestamp(*names)
Alias for: timestamps
timestamps(*names) click to toggle source

@api private Set up attributes to timestamp when the command is called

@example

class CreateTask < ROM::Commands::Create[:sql]
  result :one
  use :timestamps
  timestamps :created_at, :updated_at
end

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

result = create_user.call
result[:created_at]  #=> Time.now.utc

@param [Array<Symbol>] names A list of attribute names

@api public

# File lib/rom/plugins/command/timestamps.rb, line 117
def timestamps(*names)
  timestamp_columns timestamp_columns.merge(names)
end
Also aliased as: timestamp