As known there are some standard timestamps fields (like created_at or updated_at) that get value when model is saved or updated. Sometimes these are not enough and you can add own.

For example, if you want add some published_at timestamp, that behaves like created_at but differs in its purpose, you can add this lines in your model

  def timestamp_attributes_for_create
    super << :published_at

There is also similar method timestamp_attributes_for_update.

#rails #activerecord #timestamps