dont recreate artist urls that havent changed

This commit is contained in:
r888888888
2014-12-03 15:01:22 -08:00
parent 02c07fefb2
commit f9c341a794
2 changed files with 15 additions and 2 deletions

View File

@@ -44,9 +44,14 @@ class Artist < ActiveRecord::Base
def save_url_string
if @url_string
urls.clear
prev = urls.map(&:url)
curr = @url_string.scan(/\S+/)
@url_string.scan(/\S+/).each do |url|
(prev - curr).each do |url|
urls.where(:url => url).destroy_all
end
(curr - prev).each do |url|
urls.create(:url => url)
end
end