Comments
-
Greg Hurrell
Ok, this is not actually anything to do with AJAX. You can repro this from the console touching only
Issue
objects. This is a bug in theacts_as_taggable
implementation:>> i=Issue.first >> i.tag "foo" >> i.tags # look, it has tags >> i.save >> i.tags # look, the tags went away on save
Basically, whenever you save a record, the tags will be blown away unless the
pending_tags
attribute is set. It's always set when you do issues#new or issues#edit, but not when you're submitting an AJAX in-place form, or using the console like in the example.Looks like this bug has been there from day one, but I'd never noticed it because tags were never exposed in the issues interface before, and issues is really the only model where I'm editing from a place other than #new or #edit actions.
One solution would be to pre-populate
pending_tags
whenever I load an object, but I don't think I am going to go that way as that will incur a database hit. I'm going to see if there's a way to detect when pending_tags has really been set to nothing (), and when it's merely not been set (
nil
). -
Greg Hurrell
Ok, I believe I've fixed this now.
Add a comment
Comments are now closed for this issue.