ruby-on-railsrubyacts-as-taggable-on

Style individual Acts_As_Taggable_on tags without having a link


I am trying to loop through the tags in my list and show them as pill badges but without being linkable.

I'm currently doing this:

<%= raw @creator.tag_list.map { |t| link_to t, tag_path(t), class: 'badge badge-pill badge-primary' }.join(' ') %>

Any help would be greatly appreciated.

Thanks,

Gerard


Solution

  • When you do not want the tags as a link then just use a <span> Instead of a link:

    <% @creator.tag_list.each do |tag| %>
      <span class="badge badge-pill badge-primary"><%= tag %></span>
    <% end %>