Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def create
- if params[:model] != nil
- zip_information = CloneDatabaseService.all_objects(params)
- unless CloneDatabase.last.nil?
- all_database_tables = return_all_database_tables
- zip_data = CloneDatabaseService.build_zip(zip_information, all_database_tables)
- model_name = CloneDatabase.last.start.strftime("%Y/%m/%d %H:%m:%S").to_s
- # By default, temp files are 0600,
- # so this line might be needed depending on your configuration:
- # XXX: Deixa o rails gerenciar o download do arquivo
- # send_data(zip_data, type: 'application/zip', filename: "#{model_name}.zip")
- send_file(zip_data.path, type: 'application/zip', filename: "#{model_name}.zip")
- zip_data.unlink
- # XXX: Remove arquivo
- # zip_data.close
- # zip_data.unlink
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement