12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'app/controllers/admin/cachings_controller.rb', line 12
def create
if params[:commit] == t('caching.delete.all').capitalize
files = params[:hidden_files]
else
files = params[:file]
end
if files
files.values.each do |file|
unless File.delete(file)
flash[:error] = t('caching.delete.failed').capitalize
return redirect_to :action => 'index'
end
end
else
return redirect_to :action => 'index'
flash[:error] = t('caching.no_files').capitalize
end
begin
FileUtils.remove_dir(Rails.cache.cache_path, true)
rescue
p 'This cache directory does not exist'
end
flash[:success] = t('caching.delete.create').capitalize
return redirect_to :action => 'index'
end
|