2012-12-27 56 views
2

我想複製此:如何在link_to幫助器中執行<i>標記?

<a href="thepledge.html" class="btn btn-inverse btn-mini btn-ten"><i class="icon-pencil"></i>Take The Pledge</a> 

我嘗試這樣做:

<%= link_to("Take the pledge", root_path, :class => "btn btn-inverse btn-mini btn-ten") do %> 
    <i class="icon-pencil"></i> 
<% end %> 

但它給了我這個錯誤:

NoMethodError at/
undefined method `stringify_keys' for "/":String 

link_to電話。

想法?

回答

2
<%= link_to(root_path, :class => "btn btn-inverse btn-mini btn-ten") do %> 
    <i class="icon-pencil"></i> 
    Take The Pledge 
<% end %> 
5

根據你需要把(完成)鏈接文本塊中,像這樣的documentation

<%= link_to(root_path, :class => "btn btn-inverse btn-mini btn-ten") do %> 
    <i class="icon-pencil">Take the pledge</i> 
<% end %>