我有一个让我感到悲伤的简单场景:
SMSVerificationsController
class SmsVerificationsController < ApplicationController
def new
end
end
路线
get 'sms_verifications/new'
Erb的
link_to sms_verifications_new_path
以上所有内容都很直接,但链接返回以下错误:
NoMethodError in SmsVerificationsController#new
undefined method `has_content_type?' for nil:NilClass
该错误还显示以下代码:
# Checks if we should perform parameters wrapping.
def _wrapper_enabled?
return false unless request.has_content_type?
ref = request.content_mime_type.ref
_wrapper_formats.include?(ref) && _wrapper_key &&
!request.request_parameters[_wrapper_key]
actionpack (5.1.1) lib/action_controller/metal/params_wrapper.rb:283:in `_wrapper_enabled?'