[英]Rails - View unseen comments
I have a Leads model which has comments. 我有一个带有评论的潜在顾客模型。 Stored in the comments model.
存储在注释模型中。
When users are browsing leads, I would like to show them how many new comments there are since the last time they viewed a particular lead's profile. 用户浏览潜在客户时,我想向他们展示自上次查看特定潜在客户的个人资料以来有多少新评论。
How would I go about this? 我将如何处理?
My initial idea is to store the last time a user browsed a lead's profile and the number of comments that come after this date would be the unread comments. 我最初的想法是存储用户上次浏览潜在客户的个人资料的时间,该日期之后出现的评论数将是未读评论。 Am I going in the right direction?
我朝着正确的方向前进吗?
seen
attribute/coulmn with default of 0 (ie not seen) to comments table with a migration. seen
属性/队列添加到带有迁移的注释表中。 seen
if you are using strong parameters or make it attribute accessible. seen
。 if !comment.seen
if !comment.seen
仅显示那些评论
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.