javascriptruby-on-railsturbolinks

not injecting "data-turbolinks": false


I am using:

I have 2 links on the page:

<p><%= link_to("Back to Dashboard", dashboard_path, "data-turbolinks": false) %></p>```

it correctly injects the turoblinks into the HTML:

<a data-turbolinks="false" href="/dashboard">Back to Dashboard</a>

But when I add it into the loop here...

<% @contacts.each do |contact| %>
<tr>
    <td><%= link_to(contact.display_full_name, lead, "data-turbolinks": false) %></td>
</tr>

<a href="/leads/11">Bob Smith</a>

It does not include data-turbolinks="false"

Any suggestions?
Many thanks.


Solution

  • As per turbolink gem documentation

    <a href="/" data-turbolinks="false">Disabled</a>
    

    data-turbolinks value should be string "false" not Boolean.

    try like this:

    <%= link_to("Back to Dashboard", dashboard_path, "data-turbolinks": "false")
    
    <% @contacts.each do |contact| %>
                <tr>
                  <td><%= link_to(contact.display_full_name, lead, "data-turbolinks": "false") %></td>
                </tr>
     %>
    

    It should work.