I am currently trying to add a custom data attribute to a Rails image\_tag to allow my jQuery to function. 

First, I am starting with an image\_tag like so: 

```
<%= image_tag("randomv1.png", class: "icon js-icon") %>

```

Second, for my jQuery, I need the image\_tag to trigger an event, and I want it to include a data attribute like the one I am using for a button here: 

```
<button class="icon js-icon" data-icon-text="Random">Icon graphic</button> 

```

Adding the class attribute is easy, but I will need the data-icon-text to function as an attribute too for the data to be displayed after a .hover. 

Based on [this previous question](https://stackoverflow.com/questions/15066830/adding-custom-data-attributes-rails-image-tag), I tried to modify the image\_tag: 

```
 <%= image_tag("randomv1.png", :class "icon js-icon" :data => { :icon-text => "Random" }) %>

```

Since this is delivering an error, can I create that custom attribute?