I cannot find any answer on this seemingly easy question. In my rails5 app some links do use turbolinks for loading new page. But some just launch full page reload.
There is no js attached to that links, turbolinks is not disabled on that links.
This link uses turbolinks:
= link_to qm_input_path('hour') do ...
<a class="navbar-brand" href="/qimen/hour/input"> ...
In the action it has
render layout: 'input'
And this link doesn't:
= link_to qm_chart_path(@foo, @bar), class: 'btn btn-default pull-right next' do ...
<a class="btn btn-default pull-right next" href="/qimen/hour/chart/foo/bar"> ...
In the action it has
render layout: guess_layout
So, nothing explicitly blocking turbolinks to work.
Why?
The issue is that the href
s in your links contain periods (.
).
Turbolinks will only handle links that it considers to be HTML. That is, those that have no extension (e.g. /post/1234
), or those which have an html
/htm
/xhtml
after the last period (e.g. /post/1234.html
). In your case, the links which are performing a full page load end with something like: /30.335098600000038
. Turbolinks will not consider this to be an HTML resource and so will not handle it.
To solve this, I'd recommend using query strings for parameters that may contain periods. For example to tidy up one of your links, you could try:
qimen/hour/chart?time=2017-06-03T15:27:48+03:00&city=St.%20Petersburg&longitude=30.335098600000038