mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 17:21:38 -05:00
Merge pull request #255 from tetebueno/patch-1
Creating exports directory if it doesn't exist
This commit is contained in:
commit
adf32353ab
1 changed files with 3 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue