我尝试制作一个完整的 DIV 作为链接,但它只是工作。这就是我所拥有的:
= link_to (user_orders_path(current_user)) do
.current_orders.box.tile.one_third.lightblue
.count
%i.icon-shopping-cart
=@current_orders
.link
- if @current_orders > 0
= link_to t('.current_orders'), user_orders_path(current_user)
- else
= t('.no_current_orders')
但不知何故,Rails 正在使它成为:
<a href="/users/1/orders"></a>
<div id="current_orders" class="box tile one_third lightblue">
<a href="/users/1/orders">
<div class="count">
<i class="icon-shopping-cart"></i>
3
</div>
</a>
<div class="link">
<a href="/users/1/orders"> </a>
<a href="/users/1/orders">Open bestellingen</a>
</div>
</div>
我究竟做错了什么?它应该生成为:
<a href="/users/1/orders">
<div id="current_orders" class="box tile one_third lightblue">
<div class="count">
<i class="icon-shopping-cart"></i>
3
</div>
<div class="link">
<a href="/users/1/orders">Open bestellingen</a>
</div>
</div>
</a>