Como personalizar páginas de erro de autenticação Http Digest em Ruby on Rails

Detalhes completos, consulte: http://p373.net/2013/11/16/how-to-customize-http-digest-authentication-error-pages-in-ruby-on-rails/

module ActionController
module HttpAuthentication
module Digest
def authentication_request_with_customization(controller, realm, message=nil)
message
= controller.render_to_string("public/401.html")
authentication_request_without_customization
(controller, realm, message)
end
alias_method_chain
:authentication_request, :customization
end
end