mirror of
https://github.com/Freika/dawarich.git
synced 2026-04-22 03:00:29 -04:00
Merge pull request #255 from tetebueno/patch-1
Creating exports directory if it doesn't exist
This commit is contained in:
@@ -72,8 +72,9 @@ class Exports::Create
|
||||
end
|
||||
|
||||
def create_export_file(data)
|
||||
file_path = Rails.root.join('public', 'exports', "#{export.name}.#{file_format}")
|
||||
|
||||
dir_path = Rails.root.join('public', 'exports')
|
||||
Dir.mkdir(dir_path) unless Dir.exist?(dir_path)
|
||||
file_path = dir_path.join("#{export.name}.#{file_format}")
|
||||
File.open(file_path, 'w') { |file| file.write(data) }
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user