In my app, a Conversation has many Messages. How to I update the updated_at
attribute of a Conversation when a new Message in that Conversation is created/saved?
I'm aware of :touch => true
, which does this, but it also updates Conversation when a Message is destroyed, which is not what I want.
Thanks.
Models
class Conversation < ActiveRecord::Base
has_many :messages
end
class Message < ActiveRecord::Base
belongs_to :conversation
end