Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails acts_as_taggable, tags losing comma on edit!? becomes one

I am using acts_as_taggable_on gem with Rails 4.2 and I have a form where you can enter tags, seperated by commas.

<div class="form-group">
  <%= f.label(:tag_list, "Tags (seperated by commas)") %><br />
  <%= f.text_field(:tag_list, :class=>"formbox")%>
</div>

The tags work fine, but when I go back to an article and edit it, the commas that were previously there disappear! For example, if I input tags:

white, light, soft

When I edit, those 3 separate tags will become 1 tag:

white light soft

Does anybody know what's happening here? It sucks to lose all those tags, I want to be able to keep all those tags upon edit.

like image 401
nvrpicurnose Avatar asked Feb 28 '15 20:02

nvrpicurnose


1 Answers

simple_form:

<%= f.input :tag_list, :label => "Tags* (seperated by commas)", :input_html => { :class => "css-class", :value => @article.tag_list.join(", ") } %>
like image 82
Kei Avatar answered Oct 22 '22 15:10

Kei