Rails 3 创建帖子评论系统的最佳方式

发布于 2024-12-02 16:11:04 字数 618 浏览 0 评论 0原文

我在这里的第一个条目。

我正在尝试向我们的帖子模型添加评论系统。然而,由于多种原因,我不确定最好的方法。我希望评论系统与 Forrst.com 上的类似,但我希望评论的访问者不需要帐户,因为该网站是我们公司的网站而不是大型社区。

功能概述为:

  1. 访问者可以对帖子发表评论,输入姓名、电子邮件和评论。
  2. 我们的团队成员可以发表评论,我希望它们具有不同的样式,因此希望系统知道它来自我们团队之一,他们在留下评论时将登录到系统。
  3. 访客和团队成员可以回复评论。系统需要知道它是在回复哪一条评论。
  4. 最后我希望系统知道评论是否是帖子作者写的。

我已经查看并尝试了acts_as_commentable_with_threading,这看起来很完美,除了每个人都需要一个用户帐户来发表评论,这是我试图避免的,除非有人对此有其他想法?

我还通过创建注释模型并使用 Awesome_nested_set 进行线程来自己实现这一点。在评论模型中,我有一个 user_id,仅在用户登录时才会填充(这意味着他们必须是团队成员),但这看起来有点混乱。

有人对此有什么想法吗?

哦,我希望每个人都能收到对其评论的回复通知(如果是)。

提前致谢。

my first entry here.

I'm trying to add a comment system to our Posts model. However, I am not sure of the best way to go about it for a number of reasons. I'd like the comment system to be similar to that on Forrst.com but i'd rather have visitors who comment not need an account as the site is our company site not a large community.

Outline of features are:

  1. Visitor can comment on post, entering name, email and comment.
  2. Our team members can comment, i'd like these to be styled differently so would like the system to know it was from one of our team, they will be logged into the system when leaving a comment.
  3. Visitors and team members can reply to a comment. The system needs to know which comment it was in reply to.
  4. Lastly i'd like the system to know if the comment was written by the post author.

I have looked and been trying out acts_as_commentable_with_threading which seems perfect except everyone needs a user account to leave a comment, something I am trying to avoid unless anyone has other thoughts on that?

I have also implemented this myself by creating a comments model and using awesome_nested_set for the threading. Within the comments model I have a user_id which is only populated if the user is logged in (meaning they must be a team member), this seems a little messy though.

Does anyone have any thoughts on this?

Oh, and I would love each person to be notified of a reply to their comment (if pos).

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

迟月 2024-12-09 16:11:04

有很多工具可用于发表评论和使用 ruby​​ on Rails。

http://ruby-toolbox.com/categories/rails_comments.html

您也可以自定义根据自己的需求,而不是编写混乱的代码。

There are lot of tools available to post comments and working with ruby on rails.

http://ruby-toolbox.com/categories/rails_comments.html

also you can customize according your own requirement instead of writing a messy code.

小镇女孩 2024-12-09 16:11:04

如果您不想集成像 Disqus 这样的第三方服务,您可以使用 Juvia 评论公共器。您也可以使用 opinio 作为替代方案。但仅限于 Rails 3,目前正如我们所注意到的那样,开发似乎陷入了停滞。

If you do not want to integrate a third-party service like Disqus, you have Juvia The Comments and Commontator. Also you can count with opinio as alternative. but only with Rails 3 and at the moment and as notice the development seems stalled.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文