For now I've done it like this. It's a pretty bad solution but I can't get it work normally differently. I put this code in all my views where I don't refresh a page. So, the same code is in main application.html.erb file and also in two other views which are accessed via 'home' page.
<script type="text/javascript">$(document).ready(function() {
var script = 'http://s7.addthis.com/js/300/addthis_widget.js?domready=1#pubid=xxx';
if (window.addthis){
window.addthis = null;
window._adr = null;
window._atc = null;
window._atd = null;
window._ate = null;
window._atr = null;
window._atw = null;
}
$.getScript( script, function() {
addthis.layers({
'theme' : 'transparent',
'share' : {
'position' : 'left',
'numPreferredServices' : 5
}
});
});
});
</script>
I know this is a really bad solution because I c/p the same code.