I am using the old auto_complete plugin in conjunction with the acts as taggable on gem in an attempt to basically replicate the tagging behavior of Stack Overflow itself! I am more or less doing what is described in this rails cast. For single tags, this works great. However, I would really like to make it so that every time the user enters a space or a comma (much like on Stack Overflow), the autocomplete will start anew. I’d imagine there is some way to do this via regex, but I’m not sure how to go about applying this behavior to the text_field (I’d imagine using JavaScript to “restart” the autocomplete, but admittedly I am fairly weak when it comes to JavaScript. This is what my view looks like:
<%= text_field_with_auto_complete :business, :tags, {}, { :url => formatted_businesses_path(:js), :method => :get, :with => "'search=' + element.value" } %>
My controller is very straightforward, simply saving the tags for that particular business.
If someone could point me in the right direction (As I’m not sure how to go about doing this) I would greatly appreciate it.
I know this is old, but to recreate this behavior I used rails3-jquery-autocomplete with acts-as-taggable-on. They work very nicely and easily together.
Hope that helps someone.