带有Rails 4的Facebook评论插件 [英] Facebook comments plugin with rails 4

查看:51
本文介绍了带有Rails 4的Facebook评论插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Rails 4 App上实现Facebook评论插件.我遵循了Facebook评论页面上的说明.

I am trying to implement facebook comments plugin on a rails 4 App. I followed the instructions on the facebook comments page.

在body标签之后添加了脚本:

Added the scripts after the body tag:

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=1397110283902092";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

在我的视图中添加了显示div:

Added the display div in my view:

<%= content_tag :div, '', :class => "fb-comments", "data-href" => request.original_url, "data-numposts" => "5", "data-colorscheme" => "light" %>

但是该插件未加载或未在本地或远程显示,现在在控制台上显示了错误.

But the plugin isn't loading or being displayed locally or remotely, there is now error printed to the console.

如何使它工作?

谢谢

推荐答案

检查此小提琴 jsfiddle 和让我知道这一点.它显示评论,我也可以发表评论.

Check this fiddle jsfiddle and let me know on this. It displays comments and i was able to post comment also.

.

这篇关于带有Rails 4的Facebook评论插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆