Don't create import_state until project is persisted

This commit is contained in:
Douwe Maan 2018-05-08 09:46:29 +02:00
parent 0eb74426b3
commit 1bd5896cd0
No known key found for this signature in database
GPG key ID: 5976703F65143D36

View file

@ -661,9 +661,15 @@ class Project < ActiveRecord::Base
return if !force && (self[:import_status] == 'none' || self[:import_status].nil?) return if !force && (self[:import_status] == 'none' || self[:import_status].nil?)
return unless import_state.nil? return unless import_state.nil?
if persisted?
create_import_state(import_state_args) create_import_state(import_state_args)
update_column(:import_status, 'none') update_column(:import_status, 'none')
else
build_import_state(import_state_args)
self[:import_status] = 'none'
end
end end
def import_schedule def import_schedule