link_to与锚标记中的其他html

时间:2011-04-08 18:14:03

标签: html ruby-on-rails ruby-on-rails-3 jquery-mobile

在Rails中使用link_to帮助程序时,如何向链接添加其他内容?

link_to "Stephen Weber", "index.html"

创建:

<a href="index.html">Stephen Weber</a>

但是,如果我想创建它呢?

<a href="index.html">
    <h3>Stephen Weber</h3>
    <p><strong>You've been invited to a meeting at Filament Group in Boston, MA</strong></p>
    <p>Hey Stephen, if you're available at 10am tomorrow, we've got a meeting with the jQuery team.</p>
    <p class="ui-li-aside"><strong>6:24</strong>PM</p>
</a>

我正在玩jQuery Mobile,这就是格式化列表中内容所需要的。

1 个答案:

答案 0 :(得分:54)

你能做到:

 <%= link_to 'index.html', :title => "Some link" do %>
     <h3> Stephen Weber </h3>
     ...
 <% end %>