在由devise gem管理的/sign_in?locale=en
页面上进行身份验证,会生成以下错误:
undefined method `unshift' for nil:NilClass
从日志中:
SyntaxError - syntax error, unexpected '{', expecting keyword_end
...ion only: [:create, :destroy] { request.env["devise.skip_tim...
... ^
/Users/deploy/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/devise-4.2.0/app/controllers/devise/sessions_controller.rb:5: syntax error, unexpected '}', expecting keyword_end
..."devise.skip_timeout"] = true }
... ^:
devise (4.2.0) app/controllers/devise/sessions_controller.rb:5:in `'
NoMethodError (undefined method `unshift' for nil:NilClass):
Rendered /Users/deploy/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/actionpack-4.2.10/lib/action_dispatch/middleware/templates/rescues/_source.erb (1.1ms)
2.5.3而非2.4.5发生错误。会话控制器的相关行似乎是第2行,而不是根据错误消息显示的第5行:
skip_before_filter :authenticate_user!, :only => [:create, :new]
# skip_authorization_check only: [:create, :failure, :show_current_user, :options, :new]
respond_to :json
这似乎是a syntactic issue时,错误消息暗示了要设计代码,而不是应用程序代码。 Devise在gemfile中没有建立特定的版本,并且bundle update
已正常运行。
解决此问题的正确方法是什么?