Integrating AddThis with Rails 4
01 Jun 14
In this short tutorial, I will explain how I got AddThis working with turbolinks in a rails 4 application
So I recently signed up for Addthis and added their share tools to my tutorials section of this site. I had AddThis working normally on a full page load but navigation to a different page caused the links not to show up as I was using turbolinks gem which makes following links in a rails application feel amazingly faster.
I spent alot of time searching on Google and Stackoverflow for a solution but most of them din't work for me. I stumbled upon a solution that worked for me
on the turbolinks issues page on Github. I expect this to not be a terribly popular article, but if I ever need to set this stuff up myself in the future, then I’ll have it written down somewhere at least!
Most of other solutions I found din't work because it looks like AddThis was setting tens of properties on window and checks for some of those before reloading, So I decided to go with this solution. Hope it helps! Thank you for reading