Passing attributes to link_to

I have to pass an attribute to links for bootstrap-image-gallery, the
docs
say to build a link like this

so then
data-gallery is called an attribute in html5, would that be a “data
attribute” in rails? how would i create the link with link_to

On Jan 23, 2016, at 7:28 PM, fugee ohu [email protected] wrote:

I have to pass an attribute to links for bootstrap-image-gallery, the docs say
to build a link like this
so then data-gallery is
called an attribute in html5, would that be a “data attribute” in rails? how would
i create the link with link_to

<%= link_to ‘Apple’, ‘images/apple.jpg’, data: { gallery: ‘some value’ }
%>

If you’ve built a delete link before, you will recall those have data: {
confirm: ‘Are you sure?’ } on them.

Walter

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs