私有方法“ active_for_authentication?”要求#<user:0x00007f2d0e04d3e0>

时间:2019-01-02 11:50:00

标签: ruby-on-rails ruby ruby-on-rails-3 ruby-on-rails-4 rubygems

注册后出现此错误:

  

NoMethodError in RegistrationsController#create
  调用'active_for_authentication?'的私有方法<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

1 个答案:

答案 0 :(得分:1)

您已将其定义到私有方法部分。公开。