activeadmin_addons
activeadmin_addons copied to clipboard
Tags input submits a string instead of an array
"tag_names"=>"Awesome,Test,Test 123"
The form field is defined like this:
f.input :tag_names, label: "Tags", as: :tags, collection: Tag.all.pluck(:name)
And inside the model I have:
def tag_names=(*names)
self.tags = Tag.find_or_create_by_names(*names)
end
def tag_names
self.tags.pluck(:name)
end
I'm new to this gem but why don't you do
f.input :tag_ids, label: "Tags", as: :tags, collection: Tag.all
@vccoffey the input is in the tags mode, which enables you to add new tags on the fly.