Today I Learned

hashrocket A Hashrocket project

Force link to make a turbo_stream request in Rails

Adding the data-turbo-stream attribute to your link will force it to make a vnd.turbo-stream.html request instead of text/html.

<a href="/some-url" data-turbo-stream>Some URL

Using a Rails link_to would look like this:

<%= link_to "Some URL", "/some-url", data: {turbo_stream: ""} %>
See More #rails TILs
Looking for help? Hashrocket has been an industry leader in Ruby on Rails since 2008. Rails is a core skill for each developer at Hashrocket, and we'd love to take a look at your project. Contact us and find out how we can help you.