javascriptruby-on-railshtmlruby-on-rails-4facebook-likebox

Facebook Like Box not showing until refresh in Rails 4


I followed the instructions that were given in the Facebook Developers page in order to include a like box in my Rails 4 application. It always worked for me great in previous apps, but for some reason, in the current app I need to refresh the page after redirecting to it in order to make the like box show up.

Anyone manage to encounter this problem and found a solution?


Solution

  • Do you use turbolinks gem in this project? It is known to cause problems like that. Have a look at offcial solution http://reed.github.io/turbolinks-compatibility/facebook.html or see what worked for other people here Facebook SDK and rails 4 Turbolinks

    If you're not using turbolinks, please add some info about what js libraries are you using, most likely one of them is to blame.