Ruby on rails Rails重定向太多,尽管它到达了不';不要重定向到任何地方

Ruby on rails Rails重定向太多,尽管它到达了不';不要重定向到任何地方,ruby-on-rails,redirect,Ruby On Rails,Redirect,我试图阻止登录用户注册,因此我有以下代码: class UsersController < ApplicationController include SessionHelper before_action :new , :notLoggedIn def notLoggedIn() if logged_in? redirect_to current_user end end 无论何时我登录(目前这是通过注

我试图阻止登录用户注册,因此我有以下代码:

class UsersController < ApplicationController
  include SessionHelper
  before_action :new , :notLoggedIn


    def notLoggedIn()
        if logged_in?
            redirect_to current_user
        end
    end
无论何时我登录(目前这是通过注册自动完成的。虽然我不确定这是否相关,但没有实际登录的页面)预期的页面
users/7
都在URL中,但是浏览器告诉我,有一个无限循环,它反过来不会显示页面

除了将用户加载到实例变量中之外,
show
方法实际上没有做任何事情

def show
    @user = User.find(params[:id])
end

我是否在刹车一些我不知道的轨道原理?为什么浏览器会显示相关的url,但它不会呈现它,而是告诉我
此网页有一个重定向循环

新建通常是RESTful操作之一,而不是before操作。你是说这个吗

before_action :notLoggedIn, :only => :new

我敢打赌“新”不是以前的事_action@Swards不知道你是什么意思?
before_action :notLoggedIn, :only => :new