Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tag_list_changed bounces between array or string inconsistently. #548

Closed
alexQueue opened this issue May 28, 2014 · 5 comments
Closed

tag_list_changed bounces between array or string inconsistently. #548

alexQueue opened this issue May 28, 2014 · 5 comments

Comments

@alexQueue
Copy link

This is causing problems with an audit logger we're using that uses the attribute_was and attribute_changed methods, which keep on changing even though nothing happens.
Seems to be due to changed_attributes storing the tag list as a string instead of an array

user.tag_list
=> ["d",  "c", "b", "a"]
user.tag_list_was
=> ["d",  "c", "b", "a"]
user.tag_list = user.tag_list.sort
user.tag_list_changed?
=> true
user.tag_list_change
=>["d, c, b, a",['a','b','c','d']]
user.tag_list_was
=>"d, c, b, a"
user.save
...
user.tag_list
=>['a', 'b', 'c', 'd']

This also causes problems where a simple change of order causes the attributes to update, but I'm not sure if that is an issue or a feature since someone may depend on ordered tags.

@seuros
Copy link
Collaborator

seuros commented May 28, 2014

It not a feature that since it make no sense and this is not Microsoft.
I will look into it.

@seuros
Copy link
Collaborator

seuros commented May 28, 2014

Sorry for delay, i had something else to do.
Could you try https://github.com/seuros/acts-as-taggable-on/tree/dirtyorder ?

@alexQueue
Copy link
Author

Seems to have fixed it. Thanks!

@seuros seuros closed this as completed in c61f724 May 28, 2014
seuros added a commit that referenced this issue May 28, 2014
Fix dirty marking when tags are not ordered. Fixes #548
@seuros
Copy link
Collaborator

seuros commented May 28, 2014

You can use rubygem now.

nikushi pushed a commit to yohoushi/acts-as-taggable-on that referenced this issue Dec 31, 2014
nikushi pushed a commit to yohoushi/acts-as-taggable-on that referenced this issue Dec 31, 2014
davidbasalla added a commit to alphagov/transition that referenced this issue Aug 23, 2016
The `ignore` block that is removed from 'mapping.rb' in this commit was added in 68750ea#diff-8b7db4d5cc4b8f6dc8feb7030baa2478 to guard against version updates to the `tag_list` when nothing was actually changing.

In 33588a4 we upgraded the ‘acts-as-taggable-on’ gem to 3.5.0. This included release 3.2.6 which contained a fix for `tag_list_changed` bouncing between String and Array inconsistently (see issue [here](mbleigh/acts-as-taggable-on#548)), which means we do not need the extra ignore block anymore.

We add some tests around versioning of tag_list to be explicit about what we expect to happen, since 'tag_list' is a more complex attribute which comes from the ‘acts-as-taggable-on’ gem.
tekniklr pushed a commit to tekniklr/acts-as-taggable-on that referenced this issue Mar 19, 2021
tekniklr pushed a commit to tekniklr/acts-as-taggable-on that referenced this issue Mar 19, 2021
Fix dirty marking when tags are not ordered. Fixes mbleigh#548
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants