Question

if my controller is page_controller.rb and the associated javascript file under assets is page.js then nothing in the page.js will reload when I use re_direct

I tried the following

redirect_to page_path, data: { no_turbolink: true }

but it didn't work, although it works fine with link_to

link_to 'page title', page_link, data: { no_turbolink: true }

any idea?

Edit:

I have in the following in my index.html.haml:

%li
  = link_to status, page_status_path({param1: hello, param2: hello2})

and in my controller I have:

def index
  ....
end

def status
  redirect_to index_path, data: { no_turbolink: true }
end

Now I know that the turbo link path doesn't make sense but how to load the javascript when I redirect back to index?

Was it helpful?

Solution

Turbolinks doesn't load some js files as you browse page to page (It's because the nodes on which you bind events no longer exist.), but this gem solves that problem.

gem "jquery-turbolinks"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top