私有方法`active_for_authentication?'呼吁#<User:0x00007f2d0e04d3e0>

private method `active_for_authentication?' called for #<User:0x00007f2d0e04d3e0>

注册后出现这个错误:

NoMethodError in RegistrationsController#create
private method 'active_for_authentication?' called for <User:0x00007f2d0e04d3e0>

**Extracted source (around line #430):**

428 def method_missing(method, *args, &block)
429 if respond_to_without_attributes?(method, true)
430    super
431 else
432  match = match_attribute_method?(method.to_s)
434  match ? attribute_missing(match, *args, &block) : super

在我的用户模型中我有:

def active_for_authentication? 
 super && approved? 
end 

def inactive_message 
 approved? ? super : :not_approved
end

您已将其定义到私有方法部分。做到 public.