当我在登录后点击后退按钮时,Rails应用程序崩溃了

时间:2017-12-22 17:31:46

标签: ruby-on-rails devise

我在我的Rails应用程序中实现了Devise,并在登录后重定向:

def after_sign_in_path_for(resourse)
  case resource 
    when User
      # If the user profile isn't filled out, direct users there
      if current_user.user_profile.nil?
        return new_user_profile_path

      # If the profile isn't filled out, direct users there.
      elsif !current_user.user_profile.nil? && current_user.user_profile.profileable.nil?
        return new_dentist_detail_path
      elsif !current_user.user_profile.nil? && !current_user.user_profile.profileable.nil? && current_user.user_profile.competencies.count == 0
        return edit_competencies_path
      else
        return user_dashboards_show_path # ToDo: redirect to dashboard new
      end

登录和重定向工作正常,但如果我在登录后点击后退按钮,我会得到:

Cannot redirect to nil!
#   redirect_to post_url(@post) and return
def redirect_to(options = {}, response_status = {})
   raise ActionControllerError.new("Cannot redirect to nil!") unless options
   raise AbstractController::DoubleRenderError if response_body

   self.status        = _extract_redirect_to_status(options, response_status)

enter image description here

0 个答案:

没有答案