Don’t import the same URI multiple times

Use url as unique identifier during import
This commit is contained in:
Andreas Haller 2015-04-28 00:47:26 +02:00
parent 460986e7ff
commit 5ea5aae4b8

View file

@ -16,7 +16,8 @@ class Paper < ActiveRecord::Base
originator: record['originator'],
published_at: record['published_at'],
}
create!(attributes)
record = find_or_initialize_by(url: attributes[:url])
record.update_attributes!(attributes)
end
end
end