💄 add username and date-time in exported file name

This commit is contained in:
Arpit Jalan
2015-01-15 23:00:59 +05:30
parent 14ea59b623
commit c619aed8f9
5 changed files with 21 additions and 12 deletions

View File

@@ -12,7 +12,7 @@ class UserExport < ActiveRecord::Base
def self.remove_old_exports
expired_exports = UserExport.where('created_at < ?', 2.days.ago).to_a
expired_exports.map do |expired_export|
file_name = "#{expired_export.export_type}-#{expired_export.id}.csv.gz"
file_name = "#{expired_export.file_name}-#{expired_export.id}.csv.gz"
file_path = "#{UserExport.base_directory}/#{file_name}"
if File.exist?(file_path)
@@ -33,7 +33,7 @@ end
# Table name: user_exports
#
# id :integer not null, primary key
# export_type :string(255) not null
# file_name :string(255) not null
# user_id :integer not null
# created_at :datetime
# updated_at :datetime