Search code examples
ruby-on-railsturbolinks

How can I make a form with method="get" submit with Turbolinks


I have a search form on my page, and it is safe for Turbolinks to be enabled as it is using method="get"

Is there any easy way to have the form submit under control of Turbolinks (ie avoid page refresh)


Solution

  • At the turbolinks project, there's issue #64 where someone has written a Coffeescript implementation for Rails.

    Add the code provided at that link. It adds a turboforms function that needs to be called at page ready, like this:

    $(turboforms);
    

    I'm in the process of implementing this, I'll update my answer if I find out anything else that's useful.