Skip to content
Browse files

Stop caching instance methods.

Checking files on every exception is not that expensive and it stops us
from having to bounce the server whenever we add/remove a template.

I'm not completely sure why the bouncing was necessary. Seems that the exception
would be fresh each time. But perhaps I am missing something so just removing
caching for now.
  • Loading branch information...
1 parent 9e080df commit 557ffa471b8a20d5b8c7fbd38494559f975ceb6e @eric1234 committed Oct 19, 2012
Showing with 4 additions and 5 deletions.
  1. +4 −5 app/models/better_exception_app/http_error.rb
View
9 app/models/better_exception_app/http_error.rb
@@ -33,18 +33,17 @@ def formatted format
# A template in the configured error_files_paths that will satisify
# the current symbol.
def template
- @template ||= possible_templates.find {|t| File.exists? "#{t}.html"}
+ possible_templates.find {|t| File.exists? "#{t}.html"}
end
# The end-user understandable description configured by the locale
# files. Apps can easily override these to make them more relevant
# to their specific use case if needed. If description is not defined
# in locale file then nil is returned.
def description
- return @description if defined? @description
- @description = I18n.t "http.status.description.#{symbol}"
- @description = nil if @description =~ /translation missing/
- @description
+ description = I18n.t "http.status.description.#{symbol}"
+ description = nil if description =~ /translation missing/
+ description
end
private

0 comments on commit 557ffa4

Please sign in to comment.
Something went wrong with that request. Please try again.