Skip to content

Commit

Permalink
Cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandermeindl committed Sep 25, 2024
1 parent 59a5040 commit 0472465
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/additional_tags/tags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ def merge(tag_name, tags_to_merge)
ActsAsTaggableOn::Tagging.transaction do
tag = ActsAsTaggableOn::Tag.find_by(name: tag_name) || ActsAsTaggableOn::Tag.create(name: tag_name)
# Update old tagging with new tag
ActsAsTaggableOn::Tagging.where(tag_id: tags_to_merge.map(&:id)).update_all tag_id: tag.id
ActsAsTaggableOn::Tagging.where(tag_id: tags_to_merge.map(&:id))
.update_all tag_id: tag.id
# remove old (merged) tags
tags_to_merge.reject { |t| t.id == tag.id }.each(&:destroy)
# remove duplicate taggings
Expand Down

0 comments on commit 0472465

Please sign in to comment.