conversation_participation.rb 285 B

123456789101112
  1. class ConversationParticipation < ApplicationRecord
  2. belongs_to :user
  3. belongs_to :conversation
  4. validates :user_id, presence: true
  5. validates :conversation_id, presence: true
  6. before_save :set_viewed_at_to_now
  7. def set_viewed_at_to_now
  8. self.viewed_at = Time.now
  9. end
  10. end