Created
June 11, 2018 04:32
-
-
Save maulayyacyber/82e9b5f94bc378d143ea44b4525d21e3 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
def not_found | |
raise ActionController::RoutingError.new('Not Found') | |
rescue | |
render_404 | |
end | |
def render_404 | |
render file: "#{Rails.root}/app/views/errors/error404", status: :not_found | |
end | |
def current_user | |
@current_user ||= User.find(session[:user_id]) if session[:user_id] | |
end | |
helper_method :current_user | |
def authorize | |
not_found unless current_user | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment