30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'app/models/resource_export_file.rb', line 30
def export!
transition_to!(:started)
role_name = user.try(:role).try(:name)
tsv = Manifestation.export(role: role_name)
self.resource_export = StringIO.new(tsv)
self.resource_export.instance_write(:filename, "resource_export.txt")
save!
transition_to!(:completed)
mailer = ResourceExportMailer.completed(self)
send_message(mailer)
rescue => e
transition_to!(:failed)
mailer = ResourceExportMailer.failed(self)
send_message(mailer)
raise e
end
|