我运行着一个位于 localhost:5000 的 Rails 站点,同时还有一个本地 Discourse 服务器运行在 localhost:3000。我想为文章(在我的案例中是 Rails 资源)启用评论功能,因此已在 Discourse 管理面板中设置了一个可嵌入的主机:
这是我添加到 Rails 视图中的脚本片段:
<div id='discourse-comments'></div>
<script type="text/javascript">
DiscourseEmbed = { discourseUrl: 'http://localhost:3000/',
discourseEmbedUrl: '<%= "http://localhost:5000/articles/#{@article.id}" %>' };
(function() {
var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')
[0]).appendChild(d);
})();
我收到了“正在加载讨论…
