【发布时间】:2013-09-02 18:29:06
【问题描述】:
在我的 application_controller.rb 中有一行
# Get the previous url string nicely.
previousPath = Rails.application.routes.recognize_path(request.referrer)
但是我在那一行得到了这个错误
NoMethodError (undefined method `authenticate?' for nil:NilClass)
这似乎与设计有关。 但是当我确实包含 Devise::TestHelpers 时,我得到 env is not defined 之类的,这似乎不是一个好的解决方案。
关于如何在不需要我捕获错误或正则表达式来拆分路径的情况下解决此问题的任何想法?
【问题讨论】:
标签: ruby-on-rails authentication devise nomethoderror