Created
August 11, 2015 09:14
-
-
Save yamaaki/d06cb94dca39c3515cd9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
protect_from_forgery with: :exception | |
def after_sign_in_path_for(resource) | |
return members_path if resource.class.name == 'Admin' | |
return edit_member_registration_path if resource.class.name == 'Member' | |
root_path | |
end | |
def after_sign_out_path_for(resource) | |
return new_admin_session_path if resource == :admin | |
return new_member_session_path if resource == :member | |
root_path | |
end | |
if Rails.env.production? | |
rescue_from Exception, with: :error500 | |
rescue_from ActiveRecord::RecordNotFound, ActionController::RoutingError, with: :error404 | |
end | |
def error404 | |
render 'error404', status: 404, formats: [:html] | |
end | |
def error500(e) | |
logger.error [e, *e.backtrace].join("\n") | |
render 'error500', status: 500, formats: [:html] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment