[#4604] Add buttons for load and clear the caches

This commit is contained in:
Eric Davis
2010-10-13 12:08:06 -07:00
parent 7824eadc94
commit e4f1a623f1
5 changed files with 52 additions and 2 deletions

View File

@@ -19,4 +19,17 @@ class RateCachesController < ApplicationController
end
end
def update
if params[:cache].present?
if params[:cache].match(/missing/)
Rate.update_all_time_entries_with_missing_cost
flash[:notice] = l(:text_caches_loaded_successfully)
elsif params[:cache].match(/reload/)
Rate.update_all_time_entries_to_refresh_cache
flash[:notice] = l(:text_caches_loaded_successfully)
end
end
redirect_to :action => 'index'
end
end

View File

@@ -11,3 +11,8 @@
<%= l(:text_last_cache_clearing_run) %><%= h(@last_cache_clearing_run) %>
</p>
</div>
<p>
<%= button_to(l(:text_load_missing_caches), {:controller => 'rate_caches', :action => 'update', :cache => 'missing'}, :method => :put) %>
<%= button_to(l(:text_clear_and_load_all_caches), {:controller => 'rate_caches', :action => 'update', :cache => 'reload'}, :method => :put) %>
</p>