mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2024-12-22 15:43:14 +01:00
Don’t import the same URI multiple times
Use url as unique identifier during import
This commit is contained in:
parent
460986e7ff
commit
5ea5aae4b8
1 changed files with 2 additions and 1 deletions
|
@ -16,7 +16,8 @@ class Paper < ActiveRecord::Base
|
||||||
originator: record['originator'],
|
originator: record['originator'],
|
||||||
published_at: record['published_at'],
|
published_at: record['published_at'],
|
||||||
}
|
}
|
||||||
create!(attributes)
|
record = find_or_initialize_by(url: attributes[:url])
|
||||||
|
record.update_attributes!(attributes)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue