I have a problem trying to make a list from a acts_as_taggable_on tag_list I have tag list array, and I want to list it so im trying this:
<%= proyects.tag_list.each do |tagsx| %>
* <%= tagsx %> <br>
<% end %>
And I get the list im looking for, but also the whole array again... When it renders, looks like this..
* AJAX
* Rails
* Heroku
* Prototype
AJAX, Rails, Heroku, Prototype
Any ideas on getting rid of the last line? Or do you guys know a more efficient way of achieving this?
Thanks in advance.
Change this:
<%= proyects.tag_list.each do |tagsx| %>
to this:
<% proyects.tag_list.each do |tagsx| %>
You don't want to output the return value of the .each
call, just the elements of the array. Calling Array#each
with a block returns the array (as you are):
each {|item| block } → ary
each → an_enumerator
Calls block once for each element inself
, passing that element as a parameter. If no block is given, an enumerator is returned instead.
and that's were the comma delimited list is coming from.