I solved the issue, the problem was some behaviour of turbolink rails gem.
The solution was to add all my content as a anonymous function like that:
var content = function() {
... content ...
};
And later using turbolinks function page:load in order to execute my code again
$(document).on('page:load', content);
Also I had to add this regular jquery function to load my content too:
$(document).ready(content);
I hope this help some people.