Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails redirect_to - I also want to the page to reload

Turbolinks is running throughout the app. I need the page to reload in a certain scenario, inside a create method.

This redirects to the correct page, but does not reload the page:

redirect_to convos_path


This redirects to convos_path, but does not reload the page

redirect_to convos_path, data: { no_turbolink: true } and return

This doesn't do anything

redirect_to convos_path, turbolinks: false and return

I can see in the server logs it says

Rendered convos/index.html.erb within layouts/application (12.0ms)

How can I do a redirect_to, and have the page reload when it goes there?

like image 648
gwalshington Avatar asked Dec 19 '22 08:12

gwalshington


2 Answers

Rails Turbolinks 5

Redirect and reload full page

redirect_to @convos_path, turbolinks: false
like image 185
Marcelo Austria Avatar answered Dec 20 '22 20:12

Marcelo Austria


I got the solution from here.

<a data-turbolinks='false' href="url_here">Link Here</a>
like image 40
Alfredo Roca Mas Avatar answered Dec 20 '22 22:12

Alfredo Roca Mas