Commit 64d312c3 by Xuan Trung Le

update handling exception rails

parent 8d0f1d38
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
helper_method :clear_session_candidate
rescue_from ActiveRecord::RecordNotFound, :with => :error_not_found
def clear_session_candidate
session[:candidate] = {}
......@@ -14,4 +15,8 @@ class ApplicationController < ActionController::Base
super
end
end
def error_not_found
render file: 'public/404.html'
end
end
......@@ -54,14 +54,17 @@
</style>
</head>
<body class="rails-default-error-page">
<body class="rails-default-error-page content">
<!-- This file lives in public/404.html -->
<div class="dialog">
<div>
<h1>The page you were looking for doesn't exist.</h1>
<p>You may have mistyped the address or the page may have moved.</p>
</div>
<p>If you are the application owner check the logs for more information.</p>
<p>Go back to the previous page after 5s</p>
</div>
</body>
<script type="text/javascript">
setTimeout(function(){history.back();}, 5000)
</script>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment