IRB Rocks!

# Hack your code

Update timestamp of a model in Rails

Recently I need to update timestamps of a model because I use this value as "last seen". In a Job, I update a model or others associated to it, so in the second case, I need to update timestamps.

Instead of use model.update(update_at:, Rails provide us with touch method to perform this task:

# Update update_at with current time
# Update last_seen

gem share .gem