【发布时间】:2011-03-15 20:56:41
【问题描述】:
在使用 link_to 方法生成的链接正文中嵌入 HTML 的最佳方法是什么?
我基本上想要以下内容:
<a href="##">This is a <strong>link</strong></a>
我一直在尝试按照Rails and the <span> tag 中的建议进行此操作,但没有运气。我的代码如下所示:
item_helper.rb
def picture_filter
#...Some other code up here
text = "Show items with " + content_tag(:strong, 'pictures')
link_to text, {:pics => true}, :class => 'highlight'
end
item_view.html.erb
#...
<%=raw picture_filter %>
#...
【问题讨论】:
标签: ruby-on-rails link-to