Search code examples
ruby-on-railspolymerturbolinks

ruby on rails 5, turbolinks 5 and polymer


I have issues using rails 5 & turbolinks with Polymer. I'm using the gem : 'polymer-rails' in my app/views/layout/application.html.erb I have :

<%= html_import_tag 'application', 'data-turbolinks-track' => true %>

I also tried to add :

$(document).on("ready turbolinks:load", function() {
    return document.documentElement.replaceChild(
        document.importNode(document.body, true), document.body
    );
});

Both outside the body, but polymer still breaks turbolinks. Any idea ?


Solution

  • Turbolinks and Polymer both aim to accomplish the same thing - partial page replacement but do so in different ways. Using turbolinks on top of polymer is superfluous and will give you little more than headaches.

    Note that the polymer-rails example application does not have turbolinks installed. The solution is pretty simple - remove turbolinks from your assets manifest and gemfile.