blob: 73d06d968d4e1d8152205eff5e0ea4510187c050 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
class Import::Base < ActiveRecord::Base
self.table_name = "imports"
validates :file, presence: true
def self.messages_class_name
"Import::Message"
end
def self.resources_class_name
"Import::Resource"
end
include IevInterfaces::Task
def self.model_name
ActiveModel::Name.new Import::Base, Import::Base, "Import"
end
def child_change
return if self.class.finished_statuses.include?(status)
super
update_referentials
end
def update_referentials
return unless self.class.finished_statuses.include?(status)
children.each do |import|
import.referential.update(ready: true) if import.referential
end
end
private
def initialize_fields
super
self.token_download = SecureRandom.urlsafe_base64
end
end
|