I'm trying to implement a simple Inbox system for users of my app so that can send basic messages to each other - just like in many forum systems.
If User has_many :messages
, how do I keep track of and notify the User of messages unread since last time they were read?
I'm thinking clicks on the link to the Messages
screen need to be recorded in a separate table (MessagesClicks
).
Is that the best approach here?
So then I check the MessagesClicks
table to see if any new messages have arrived since the last time that link was clicked - based on a last_clicked
or updated_at
field.