protected Method

Rescue.render_optional_error_file(status_code)

Attempts to render a static error page based on the status_code thrown, or just return headers if no such file exists. For example, if a 500 error is being handled Rails will first attempt to render the file at public/500.html. If the file doesn’t exist, the body of the response will be left empty.

Source Code

# File action_controller/rescue.rb, line 154
def render_optional_error_file(status_code)
  status = interpret_status(status_code)
  path = "#{RAILS_ROOT}/public/#{status[0,3]}.html"
  if File.exist?(path)
    render :file => path, :status => status
  else
    head status
  end
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.