Search code examples
cssruby-on-rails-3.1hyperlinkasset-pipeline

rails 3.1 link_to image_tag where image data is embedded as string


Ok I am trying to convert the following tag into a link_to statement that rails can understand. can anyone send me in the right direction

I'm trying to convert this:

<li class="topmenu"><a href="/history" style="height:24px;line-height:24px;"><img src="data:image/png;base64,iVBORw0KGgoAAAANSU.........." alt="History"/>History</a></li>

Into something like this:

<li class="top menu"><%= link_to "History" + image_tag(data:image/png;base64,iVBORw0KGgoAAAANSU..........) %></li>

The above code obviously doesn't work, but there has to be a way. any ideas


Solution

  • I ended up doing something like this

    <%=link_to image_tag("news.png") + "Newsletter", newsletter_path,:style => "height:24px;line-height:24px;"%>
    

    There was no need for the block in the answer listed above.