Rails Rails Admin Secure Page

config.authorize_with do |controller|
  if current_user.nil?
    redirect_to main_app.new_account_session_path, flash: {error: 'Please Login to Continue..'}
  elsif !current_user.admin?
    redirect_to main_app.root_path, flash: {error: 'You are not Admin bro!'}
  end
end
Fragile Flatworm