0
votes

I can't seem to figure this one out, thought I might find some direction here.

So in my current project, I'm using gems simple_form and act_as_taggable_on. The product model has act_as_taggable_on :manufacturer_tags. So naturally I would have a simple_form looking like this: <%= f.input :manufacturer_tag_list, label: "custom label", hint: "cutsom hints" %>

The manufacturer_tag_list containing an array of tags in strings,I expected the input to display: nissan, honda, bmw but instead, I got: nissan honda bmw

How do I manipulate simple_form, so it would separate by ", " instead of space?

Thank you for your time!!

2
Try adding a value attribute to it. value: @product.manufacturer_tag_list.to_sRails Guy
@RailsGuy Ahh~ so simple!! I really should do more RTFM.... Do you mind putting this in an answer? So I could mark it the correct answer.Mickey

2 Answers

2
votes

Try adding a value attribute to it. value:

@product.manufacturer_tag_list.to_s

Thanks

0
votes

It should automatically add comma (,) between each tag. If not, make sure that you did not change your delimiter to a space:

ActsAsTaggableOn::TagList.delimiter = ','

If that still does not solve your issue, you can always use gsub to add the comma back in your string:

<%= f.input :manufacturer_tag_list.gsub(' ', ', '), as: :string, label: "custom label", hint: "cutsom hints" %>