Rails 3:添加 DISQUS gem 进行评论

发布于 2024-11-16 12:08:33 字数 1025 浏览 2 评论 0原文

您好,我正在尝试在 Rails 3 应用程序中获取 DISCUS 评论。似乎没有很好的设置指南。

评论系统不会显示,我在视图中看到的只是这样:

<script type="text/javascript">var disqus_developer = 1;</script><div id="disqus_thread"></div>
<script type="text/javascript" src="http://disqus.com/forums/gppublic/embed.js"></script>
<noscript><a href="http://gppublic.disqus.com/?url=ref">View the discussion thread</a></noscript>

这是我设置它的步骤:

1)gem install disqus

2)将配置块放在 application.rb 中并添加您的具体帐户名称

config.after_initialize do
    Disqus::defaults[:account] = "youraccountname"
    # so that the comments will load up in development environment
    Disqus::defaults[:developer] = true
    Disqus::defaults[:container_id] = "disqus_thread"
    Disqus::defaults[:show_powered_by] = false
    end

3) 然后将其放入我的显示视图中

<div id ="disqus_thread">
<%= disqus_thread %>
</div>

我哪里出错了?谢谢

Hi I'm trying to get DISCUS comments working in a Rails 3 app.There doesn't seem to be a good guide for setting this up.

The comment system won't show up and all I get in the view is this :

<script type="text/javascript">var disqus_developer = 1;</script><div id="disqus_thread"></div>
<script type="text/javascript" src="http://disqus.com/forums/gppublic/embed.js"></script>
<noscript><a href="http://gppublic.disqus.com/?url=ref">View the discussion thread</a></noscript>

Here's the step I took to set it up:

1) gem install disqus

2) place the config block in application.rb and add your specific account name

config.after_initialize do
    Disqus::defaults[:account] = "youraccountname"
    # so that the comments will load up in development environment
    Disqus::defaults[:developer] = true
    Disqus::defaults[:container_id] = "disqus_thread"
    Disqus::defaults[:show_powered_by] = false
    end

3) then place in my show view

<div id ="disqus_thread">
<%= disqus_thread %>
</div>

Where am I going wrong? Thanks

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

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

发布评论

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

评论(1

轮廓§ 2024-11-23 12:08:33

我认为你需要使用 raw 或 html_safe。

 = raw disqus_thread

或者

 = disqus_thread.html_safe

I think you need to use raw or html_safe.

 = raw disqus_thread

or

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