malexanders
malexanders

Reputation: 3343

rails 4, content_tag, pass in data-turbolinks-track?

What is the proer syntax to pass data-turbolinks-track => 'reload' to a content_tag?

I want to do this: content_tag(:link, nil, rel: rel, href: url_for(page: page != 1 ? page : nil, only_path: false), data-turbolinks-track => reload)

But this is throwing an exception :(

Upvotes: 0

Views: 329

Answers (1)

malexanders
malexanders

Reputation: 3343

This is the correct syntax:

content_tag(:link, nil, rel: rel, href: url_for(page: page != 1 ? page : nil, only_path: false), data: {'turbolinks-track' => 'reload'})

Creates:

<link rel="next" href="http://hipyard.dev:3000/m/toronto-area-on?page=2" data-turbolinks-track="reload">

Upvotes: 0

Related Questions