artist: normalize more artist url formats.

This commit is contained in:
evazion
2022-03-16 17:17:50 -05:00
parent ded03df1ff
commit 04c03fa4e6
2 changed files with 24 additions and 4 deletions

View File

@@ -65,10 +65,8 @@ class Artist < ApplicationRecord
class_methods do
# Find all artist URLs matching `regex`, and replace the `from` regex with the `to` string.
def rewrite_urls(regex, from, to)
Artist.transaction do
Artist.joins(:urls).where_regex("artist_urls.url", regex).find_each do |artist|
artist.update!(url_string: artist.url_string.gsub(from, to))
end
Artist.joins(:urls).where_regex("artist_urls.url", regex).find_each do |artist|
artist.update!(url_string: artist.url_string.gsub(from, to))
end
end
end