Using turbolinks in a Rails link_to

Edit for Rails 5+: @ManishShrivastava correctly pointed out the different syntax needed for Rails 5 as shown in Joseph's answer.

<%= link_to('Giraffe', @giraffe, data: { turbolinks: false }) %>

For Rails 4 and below

Originally I thought you needed to use the hash rocket syntax for the symbol but that isn't the case. You can use a data: hash and inside that hash any symbols using underscores _ will be converted to dashes -.

I think most Rails developers would prefer to see the following (including myself now that I know better):

<%= link_to('Giraffe', @giraffe, data: { no_turbolink: true }) %>

But the following also works:

<%= link_to('Giraffe', @giraffe, 'data-no-turbolink' => true) %>


Turbolinks 5 uses a slightly different syntax

<%= link_to "Foo", new_foo_path(@foo), data: { turbolinks: false } %>

Source: Turbolinks Github Page