如何在使用link_to方法生成的链接中嵌入HTML内容是最佳实践?
我需要实现以下功能:
<a href="##">This is a <strong>link</strong></a>
我一直在尝试按照Rails和<span>标签中建议的方法进行操作,但是没有成功。我的代码如下:
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 %>
#...