Created
May 11, 2016 00:54
-
-
Save stevesohcot/ce4154946c352be3a0c0fbdaa1ee90f2 to your computer and use it in GitHub Desktop.
Rails Admin Namespace - Base Controller
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
# http://stevesohcot.com/tech-lessons-learned/2016/05/11/rails-create-admin-namespace | |
# /app/controllers/admin/base_controller.rb | |
class Admin::BaseController < ApplicationController | |
before_action :admin_only | |
layout "admin" | |
private | |
def admin_only | |
if current_user.email != '[email protected]' | |
redirect_to login_url, :notice => "Unauthorized" | |
#render :text => "Unauthorized" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment