相关疑难解决方法(0)

双重渲染错误轨道

不确定如何获得此错误:

AbstractController::DoubleRenderError users#create
Run Code Online (Sandbox Code Playgroud)

在我的控制器中,我得到了这个代码:

render 'new' and return
Run Code Online (Sandbox Code Playgroud)

我从bugsnag得到了日志,说我在这一行得到了错误.

这是创建方法代码:

def create
    back_button and return if params[:back_button]

    @profile = current_user.build_profile(params[:user])

    if @profile.nil? || current_user.nil? || @profile.user.nil?
      sign_out
      redirect_to signup_path and return
    end

    if @profile.new_record?
      render 'new' and return
    else
      redirect_to more_questions_path and return
    end
end
Run Code Online (Sandbox Code Playgroud)

我在此控制器中进行过滤之前:

before_filter :signed_in_user

def signed_in_user
      unless signed_in?
        store_location
        redirect_to signin_url, notice: "Please sign in."
      end
    end
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails

10
推荐指数
2
解决办法
2万
查看次数

标签 统计

ruby ×1

ruby-on-rails ×1