Reputation: 33755
So this is the HTML link I am trying to recreate using link_to
.
<a data-toggle-card data-card-id="1" data-card-title="Swimming in New York" data-card-description="Aenean lacinia bibendum nulla sed consectetur.">
I can manage everything except for the first data-toggle-card
.
For the rest, I have this:
link_to event.eventable.node.name, "#", data: {card_id: event.eventable.node.id, card_title: event.eventable.node.media.title, card_description: event.eventable.node.media.description
Notice I don't know how to tackle the data-toggle-card
on the link_to
.
How do I do this within the link_to
helper?
Upvotes: 0
Views: 64
Reputation: 1230
Using toggle_card: ""
in your data hash should work. It would look like:
link_to event.eventable.node.name, "#", data: {card_id: event.eventable.node.id, card_title: event.eventable.node.media.title, card_description: event.eventable.node.media.description, toggle_card: ""}
The link_to
helper will output data-toggle-card=""
but it should function properly. I don't believe there's a way to keep =""
from being rendered with the link_to
helper.
Upvotes: 1