Skip to content

Commit

Permalink
Fixing Sidekiq error "ActiveRecord::RecordInvalid: Text has already b…
Browse files Browse the repository at this point in the history
…een taken"
  • Loading branch information
caiosba authored and DGaffney committed Aug 14, 2024
1 parent c9103dd commit f922e3d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/concerns/article.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ def create_tag_texts_if_needed

module ClassMethods
def create_tag_texts_if_needed(team_id, tags)
tags.each do |tag|
tags.to_a.map(&:strip).each do |tag|
next if TagText.where(text: tag, team_id: team_id).exists?
tag_text = TagText.new
tag_text.text = tag
tag_text.team_id = team_id
tag_text.skip_check_ability = true
tag_text.save!
tag_text.save
end
end

Expand Down

0 comments on commit f922e3d

Please sign in to comment.