Rails: Can't set or update tag_list using a text field with acts_as_taggable_on
- by Josh
Hey everyone, I'm trying to add tagging to a rails photo gallery system I'm working on. It works from the back-end, but if I try to set or change it in the form view, it doesn't work.
I added acts_as_taggable to the photo model and did the migrations. My gallery builder is programmed to add one tag automatically to each photo it creates. This works fine, just as if it were setting it for the console. However, I can't seem to set tags using a text_field in the photo form.
Here's the code I added to my photo form:
<p>
<%= f.label :tag_list %><br />
<%= f.text_field :tag_list %>
</p>
Now, that's pretty trivial, and since :tag_list supports single-string comma-separated assignment (e.g. tag_list = "this, that, the other" #= ['this', 'that', 'the other']), I don't see why using a text field doesn't work. And to make even less sense, if a tag list has already been populated, the list will still show up in the text field when editing the photo. I just can't seem to commit any changes to the list. The documentation on their github page doesn't appear to give any information on how to set these values from the view. Any ideas?
Oh, and I'm using the Rails 3 gem version.