ユーザーがログインしている状態にアクセスしようとしています。アカウントが無効になっている場合、フラッシュメッセージでログインページにリダイレクトする必要があります。このようなことを試みています
def after_sign_in_path_for(resource)
if resource.group.slug == 'a'
@u = User.find_by_email(resource.email)
if @u.member.state_id == "someid"
'/logout'
flash[:notice]= "My message."
else
a_root_path
end
elsif resource.group.slug == 'b'
b_root_path
elsif resource.group.slug == 'c'
c_root_path
else
new_user_session_path
end
end
ユーザーのログインを停止し、そのスコープの他のすべてのルートをブロックするにはどうすればよいですか?