ruby on rails - Display Acts_as_taggable Tags seperatly -


i'm trying display each tag question has in span. use acts_as_taggable_on.

i managed below code working, it's tag cloud. meaning tags displayed.

<% tag_cloud question.tag_counts, %w[s m l] |tag, css_class| %>     <span class="label label-default">       <%= link_to tag.name, tag_path(tag.name), class: "css_class" %>     </span>   <% end %> 

to retrieve tags:

question.tag_list 

can me refactor code current tags on question shown ?

question.tag_list return string, , can not loop through it.

question.tags return array,

<% question.tags.each |tag| %>     <span class="label label-default">       <%= link_to tag.name, tag_path(tag.name), class: "css_class" %>     </span>  <% end %> 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -