Skip to content

Instantly share code, notes, and snippets.

@btwelch
Last active November 15, 2023 20:22
Show Gist options
  • Save btwelch/427a7048223e4ee782bbd8bb09d10033 to your computer and use it in GitHub Desktop.
Save btwelch/427a7048223e4ee782bbd8bb09d10033 to your computer and use it in GitHub Desktop.
application_controller.rb
...
private
def authenticate_user!
super
check_user_active!
end
def check_user_active!
if current_user && !current_user.active?
sign_out current_user
redirect_to new_user_session_path, alert: "This user account has been inactivated. Please check with your administrator if you feel this is in error."
return false
else
return true
end
end
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment