0

Im using this to make a gallery of images in my rails page. The html to put the images is this

<a href="assets/gallery/ave.jpg" title="Ave" data-gallery>
  <img src="assets/gallery/ave_tb.jpg" alt="Ave">
</a> 

im trying to make the code with erb but cant generate the 'data-gallery' part that is necessary to the javascript to work. thanks.

zorak
  • 23
  • 4
  • so far I have this <%= link_to( image_tag("gallery/ave_b.jpg"), image_path("gallery/ave.jpg",)) %> – zorak Oct 06 '14 at 22:43
  • 1
    This answer may help you: [Rails - link_to helper with data-* attribute](http://stackoverflow.com/questions/8734722/rails-link-to-helper-with-data-attribute) – Fermuch Oct 06 '14 at 22:45
  • or [this one](http://stackoverflow.com/q/26049331/525478) – Brad Werth Oct 06 '14 at 23:27

1 Answers1

0

With the help of a friend end with this solution:

<%= link_to(image_tag("gallery/chiva_tb.jpg", alt: "Chiva"), 
    image_path("gallery/chiva.jpg"), title: "Chiva", data: {gallery: nil}) %> 
zorak
  • 23
  • 4