ruby-on-rails – Rails 3:添加DISQUS gem以供评论

嗨,我正在尝试在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>

我哪里错了?谢谢

最佳答案 我认为你需要使用raw或html_safe.

 = raw disqus_thread

要么

 = disqus_thread.html_safe
点赞