Re: [Rails] passing attributes to link_to

9 views
Skip to first unread message

Walter Lee Davis

unread,
Jan 24, 2016, 9:29:43 AM1/24/16
to rubyonra...@googlegroups.com

> On Jan 23, 2016, at 7:28 PM, fugee ohu <fuge...@gmail.com> wrote:
>
> I have to pass an attribute to links for bootstrap-image-gallery, the docs say to build a link like this
> <a href="images/apple.jpg" title="Apple" data-gallery> 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

>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/745d996b-f664-4a6c-a82e-5fdd8e3917c4%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages