Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这段代码可以输出用户兴趣列表,但我不知道如何为列表的每个标签命名。
<%= raw follower.pursuit_list.map { |p| link_to p, "#" }.join(', ') %>
这段代码应该这样做:
follower.pursuit_list.map { |p| link_to p.name.titleize, "#" }.join(', ').html_safe
这意味着 PursuitList 对象响应该name方法,我将其视为此代码中的标记名称。
name