ActiveRecord::Associations#belongs_to has an option of
true, the associated object will have its
updated_on attributes set to current time.
You can also pass a symbol, in that case that attribute will be updated with the current time in addition to the
class Comment < ApplicationRecord
# When a comment is saved/destroyed, its post will
# update the updated_at/updated_on to the current time
belongs_to :post, touch: true
# When a comment is saved/destroyed, its post will update both
# the updated_at/updated_on as well as comment_last_updated_at
belongs_to :post, touch: :comment_last_updated_at
Note: No validations are performed when touching.