Im rendering a bunch of partials where I would like the :title option on an image_tag to be the same as the name of the record.
Heres what I have:
<%= link_to record do %>
<div class="record_partial">
<span class="record_partial_name"><%= record.name %></span>
<div id="record_icon_<%= record.id %>" class="recordicon">
<%= image_tag (record.recordicon.url(:recordicon)) %>
<% end %>
</div>
</div>
<% end %>
I thought this would work:
<%= image_tag (record.recordicon.url(:record icon)), :title => "<%= record.name %>" %>
But this gives:
SyntaxError in Venues#index
/Users/dave/Work/go/app/views/records/_record.html.erb:21:
syntax error, unexpected ‘>’
/Users/dave/Work/go/app/views/records/_record.html.erb:26:
unknown regexp options – dv
/Users/dave/Work/go/app/views/records/_record.html.erb:29:
syntax error, unexpected ‘<‘, expecting ‘)’ ^
/Users/dave/Work/go/app/views/records/_record.html.erb:32:
syntax error, unexpected ‘<‘, expecting ‘)’
‘);@output_buffer.to_s ^
/Users/dave/Work/go/app/views/records/_record.html.erb:32:
unterminated regexp meets end of file
Any help is much appreciated!
Try this
You already are in Ruby land, no need to open another
<%= %>block.