user2970050
user2970050

Reputation: 307

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.

Upvotes: 1

Views: 2732

Answers (2)

Deepak Gandhi
Deepak Gandhi

Reputation: 1

If you are using haml in rails, it will work in the following way:

= link_to "/dashboard", class: "active", :data => {turbolinks: "false" }

Upvotes: 0

Awlad Liton
Awlad Liton

Reputation: 9351

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.

Upvotes: 4

Related Questions