更新「lib/tasks/universal_table_tasks.rake」
fix File.exists?
This commit is contained in:
parent
a55a23d0c1
commit
3459ddff38
|
@ -11,9 +11,9 @@ namespace :universal_table_tasks do
|
|||
url = "http://#{args.url}"
|
||||
xlsx = ac.render_to_string handlers: [:axlsx], formats: [:xlsx], template: "utable_export/export", locals: {table: table, site_in_use_locales: Site.first.in_use_locales, url: url}
|
||||
dirname = "public/uploads/utable_export/#{id}"
|
||||
FileUtils.mkdir_p(dirname) unless File.exists?(dirname)
|
||||
FileUtils.mkdir_p(dirname) unless File.exist?(dirname)
|
||||
f = "#{dirname}/#{table.title.gsub(/[ "'*@#$%^&()+=;:.,?>|\\\/<~_!:,、。!?;「」〈〉【】/]/,'')}.xlsx"
|
||||
if File.exists?(f)
|
||||
if File.exist?(f)
|
||||
File.delete(f)
|
||||
end
|
||||
file = File.open(f, "w")
|
||||
|
|
Loading…
Reference in New Issue