You can create new model like drug_site or system, that could handle such situations - you could use drug_site.omniauth_authenticate(auth, current_user) and put all this logic there.