Rails 5: how to use $(document).ready() with turbo-links
<p>Turbolinks prevents normal <code>$(document).ready()</code> events from firing on all page visits besides the initial load, as discussed <a href="https://stackoverflow.com/questions/18770517/rails-4-how-to-use-document-ready-with-turbo-links">here</a> and <a href="https://stackoverflow.com/questions/18769109/rails-4-turbo-link-prevents-jquery-scripts-from-working/18770219#18770219">here</a>. None of the solutions in the linked answers work with Rails 5, though. How can I run code on each page visit like in prior versions?</p>