Make load altnames task idempotent.

This commit is contained in:
Miles Gould
2014-10-19 22:21:29 +01:00
parent 7c3059fcae
commit badb0c4fe7

View File

@@ -283,8 +283,7 @@ namespace :growstuff do
next
end
alternate_names.split(/,\s*/).each do |an|
puts "Adding alternate name '#{an}' to #{crop}"
AlternateName.create(
AlternateName.find_or_create(
name: an,
crop_id: crop_id,
creator_id: cropbot.id