Rails - acts_as_taggable_on Removes Commas When Editing

acts-as-taggable-on, delimiter, ruby, ruby-on-rails

Solution

This behavior is apparently by design in acts_as_taggable_on.

Try adding `to_s` to your tag_list in the form input:

<%= f.text_field :tag_list, value: @example_record.tag_list.to_s %>

Not ideal, but this should allow your field to display the comma separated tags properly.

Problem

I have successfully set up acts_as_taggable_on my model. As expected, when I split the tags with commas, it splits the tags correctly. However, when I edit the post the field is auto populated with the tags for editing, except the commas are now gone. This means if I hit save without putting them back in, the tags now become all one tag. I have tried using `ActsAsTaggableOn.delimiter = ' '` which works when they are one word tags. But now I have the issue that if i have a two word tag, when I edit and save the post the two word tags now become one word tags. Any help anybody might have on this would be greatly appreciated. Thanks!

Original source

Related problems