4

嗨,我正在尝试让 DISCUS 评论在 Rails 3 应用程序中工作。似乎没有一个很好的设置指南。

评论系统不会出现,我在视图中看到的是:

<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>

我哪里错了?谢谢

4

1 回答 1

2

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

 = raw disqus_thread

或者

 = disqus_thread.html_safe
于 2011-11-20T22:44:15.147 回答