master
 1module Admin
 2  class AdminController < ApplicationController
 3    before_action :restrict_access!
 4
 5    private
 6
 7    def restrict_access!
 8      redirect_to root_path unless current_user.try(:admin?)
 9    end
10  end
11end