Files
fizzy/app/models/message.rb
T
2025-04-09 14:50:58 +02:00

20 lines
442 B
Ruby

class Message < ApplicationRecord
belongs_to :card, touch: true
delegated_type :messageable, types: Messageable::TYPES, inverse_of: :message, dependent: :destroy
scope :chronologically, -> { order created_at: :asc, id: :desc }
after_create :created
after_destroy :destroyed
private
def created
card.comment_created(comment) if comment?
end
def destroyed
card.comment_destroyed if comment?
end
end