Skip to content

Fixed Persisted Updating through #{singular}_list= (currently does not update frozen_{singular}_list) #6

Open
wants to merge 1 commit into from

1 participant

@bitstrider

The problem is that updating with 'tag_list=' does not reflect changes onto @frozen_tag_list, and therefore the updated list never gets properly persisted in the database (which has a frozen_tag_list field).

model.tag_list = 'test, me out, please '
model.tag_list #=> ['me out', 'please', 'test'] # Sanitized and alphabetized
model.save #=> true

model.tag_list = 'test, again'
model.save #=> true

# But if we pull it back from storage, the update is lost.
model = MyModel.get(model.id)
model.tag_list #=> ['me out', 'please', 'test'] # NOT UPDATED TO ['test', 'again']

Simply called 'update_#{collection}' at the end of '#{singular}_list=' to handle this.

This was a problem I had with 1.0.2 and older, so it may be resolved now.

@bitstrider bitstrider Fixed update: tag_list= method calls update_tags to update @frozen_ta…
…g_list (tags-only example; works for user defined context)
76d9925
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.