【发布时间】:2010-11-17 16:08:10
【问题描述】:
我尝试将以下代码转换为 HAML。在锚点之前一切都很容易。
<% @user ||= current_user %>
<div class="stats">
<table summary="User stats">
<tr>
<td>
<a href="<%= following_user_path(@user) %>">
<span id="following" class="stat">
<%= @user.following.count %> following
</span>
</a>
我很接近:
- @user ||= current_user
.stats
%table{ :summary => "User stats" }
%tr
%td
%a
= following_user_path(@user)
%span.stat#following
= @user.following.count
following
但锚并不完全正确。
我相信我应该能够使用 link_to 来做到这一点,但我不清楚如何在 link_to 的参数中混合嵌入的 SPAN 标签。这应该怎么做?
感谢您的帮助。
汤姆
【问题讨论】:
标签: ruby-on-rails haml