I have a link_to_function working correctly in my rails app, but I've tried wrapping it around some ruby code using "do", and it's not executing the code it's wrapped around:
<li class="comment-list-item" id="<%=comment.id%>">
<%= link_to_function "test", "goToStepComment('#{step.id}', '#{comment.id}')" do %>
<div class="comment-list-image">
<% if User.find(comment.user_id).avatar_url != nil %>
<%= image_tag(User.find(comment.user_id).avatar_url(:thumb), :class=>"commentAvatar img-polaroid") %>
<% else %>
<%= image_tag("default_avatar.png", :class=>"commentAvatar img-polaroid") %>
<% end %>
</div>
<div class="comment-list-title">
<p><%= truncate(User.find(comment.user_id).username, length: 13) %> commented on <%= truncate(step.name, length: 20) %>: "<%=truncate(comment.body)%>"</p>
</div>
<% end %>
</li>
This gets rendered as:
<li class="comment-list-item" id="40" style="display: list-item;">
<a href="#" onclick="goToStepComment('114', '40'); return false;">test</a>
</li>
How do I wrap a link_to_function around ruby code?