Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

json2d
Copy link

@json2d json2d commented May 15, 2011

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.

…g_list (tags-only example; works for user defined context)
morygonzalez added a commit to morygonzalez/dm-tags that referenced this pull request Jun 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant