| Class | ApplicationController |
| In: |
app/controllers/application_controller.rb
|
| Parent: | ActionController::Base |
# File app/controllers/application_controller.rb, line 17
17: def self.expire_cache
18: begin
19: FileUtils.rm_rf(File.join(RAILS_ROOT, "public", "bar"))
20: FileUtils.rm_rf(File.join(RAILS_ROOT, "public", "cat4_womens_race_series"))
21: FileUtils.rm_rf(File.join(RAILS_ROOT, "public", "competitions"))
22: FileUtils.rm_rf(File.join(RAILS_ROOT, "public", "events"))
23: FileUtils.rm_rf(File.join(RAILS_ROOT, "public", "people"))
24: FileUtils.rm_rf(File.join(RAILS_ROOT, "public", "rider_rankings"))
25: FileUtils.rm_rf(File.join(RAILS_ROOT, "public", "results"))
26: FileUtils.rm_rf(File.join(RAILS_ROOT, "public", "schedule"))
27: FileUtils.rm_rf(File.join(RAILS_ROOT, "public", "teams"))
28: FileUtils.rm(File.join(RAILS_ROOT, "public", "bar.html"), :force => true)
29: FileUtils.rm(File.join(RAILS_ROOT, "public", "cat4_womens_race_series.html"), :force => true)
30: FileUtils.rm(File.join(RAILS_ROOT, "public", "home.html"), :force => true)
31: FileUtils.rm(File.join(RAILS_ROOT, "public", "index.html"), :force => true)
32: FileUtils.rm(File.join(RAILS_ROOT, "public", "results.html"), :force => true)
33: FileUtils.rm(File.join(RAILS_ROOT, "public", "rider_rankings.html"), :force => true)
34: FileUtils.rm(File.join(RAILS_ROOT, "public", "schedule.html"), :force =>true)
35: FileUtils.rm(File.join(RAILS_ROOT, "public", "teams.html"), :force =>true)
36: rescue Exception => e
37: logger.error e
38: end
39:
40: true
41: end
# File app/controllers/application_controller.rb, line 46
46: def clear_racing_association
47: RacingAssociation.current = nil
48: end
# File app/controllers/application_controller.rb, line 54
54: def expire_cache
55: if perform_caching
56: ApplicationController.expire_cache
57: end
58: end
# File app/controllers/application_controller.rb, line 93
93: def render_404
94: respond_to do |type|
95: type.html {
96: local_path = "#{Rails.root}/local/public/404.html"
97: if File.exists?(local_path)
98: render :file => "#{RAILS_ROOT}/local/public/404.html", :status => "404 Not Found"
99: else
100: render :file => "#{RAILS_ROOT}/public/404.html", :status => "404 Not Found"
101: end
102: }
103: type.all { render :nothing => true, :status => "404 Not Found" }
104: end
105: end
# File app/controllers/application_controller.rb, line 107
107: def render_500
108: respond_to do |type|
109: type.html {
110: local_path = "#{Rails.root}/local/public/500.html"
111: if File.exists?(local_path)
112: render :file => "#{RAILS_ROOT}/local/public/500.html", :status => "500 Error"
113: else
114: render :file => "#{RAILS_ROOT}/public/500.html", :status => "500 Error"
115: end
116: }
117: type.all { render :nothing => true, :status => "500 Error" }
118: end
119: end
# File app/controllers/application_controller.rb, line 60
60: def render_page(path = nil)
61: unless path
62: path = controller_path
63: path = "#{path}/#{action_name}" unless action_name == "index"
64: end
65:
66: page_path = path.dup
67: page_path.gsub!(/.html$/, "")
68: page_path.gsub!(/index$/, "")
69: page_path.gsub!(/\/$/, "")
70:
71: @page = Page.find_by_path(page_path)
72: if @page
73: return render(:inline => @page.body, :layout => true)
74: end
75: end
# File app/controllers/application_controller.rb, line 77
77: def rescue_action(exception)
78: respond_to do |format|
79: format.html {
80: rescue_with_handler(exception) || rescue_action_without_handler(exception)
81: }
82: format.js {
83: log_error(exception)
84: ExceptionNotifier.deliver_exception_notification(exception, self, request, {})
85: render "shared/exception", :locals => { :exception => exception }
86: }
87: format.all {
88: rescue_with_handler(exception) || rescue_action_without_handler(exception)
89: }
90: end
91: end