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

Allow resetting of tag_lists and cached_tag_lists #479

Closed
wants to merge 1 commit into from
Closed

Allow resetting of tag_lists and cached_tag_lists #479

wants to merge 1 commit into from

Conversation

bradly
Copy link

@bradly bradly commented Feb 6, 2014

We have a tag admin area and when a tag was renamed we didn't have an easy way to update the associated cached tag lists of objects with that tag. This patch doesn't add the functionality directly, but it does give a helper method so you can loop through object.tagged_with(some_tag) and then refresh the object's cached tag list. I'm open to add more of this into the gem too, but wanted to start small and see if there is interest first.

Also, this is my first patch for this project so any feedback you have on code organization, format, or anything else, just let me know. Thanks!

@seuros
Copy link
Collaborator

seuros commented Feb 8, 2014

I think that renaming tags is bad. It will take too long for large database to invalidate the cache.

cc @bf4

@bradly
Copy link
Author

bradly commented Feb 8, 2014

@seuros Interesting. Every app that I've worked on with tags has needed an admin area for someone to normalize tags (for instance when you have a tag 'w2' and a tag 'w-2'). Also, this isn't only for renaming tags; when a tag is deleted you need to updated the cached tags lists as well.

@seuros
Copy link
Collaborator

seuros commented Feb 20, 2014

@bradly , that make sense.

@bf4 , what do you think about this ?

@bf4
Copy link
Collaborator

bf4 commented Feb 27, 2014

Sorry @seuros totally caught up in other things... But I did just release a 3.1.0.rc1 https://github.com/mbleigh/acts-as-taggable-on/blob/master/CHANGELOG.md#310rc1--2014-02-26

@joker-777
Copy link

Hi, I also was looking for a way to refresh the cached_tag_list field. I kind of assumed that the before_save hook would actually get a fresh list. I was surprised when I realized that it uses tag_list_cache_on which returns the cached version (after checking for an existing instance variable which makes sense). Changing this behavior would make your helper method unnecessary, right?

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants