10

我在哪里可以覆盖active_for_authentication?

def active_for_authentication?
  super && account_active?
end

1) 文件位置和文件名。

2) 完整文件的样子.. 等等... class something < < devise:something

原来的active_for_authentication?方法可以在 devise/lib/devise/models/authenticable.rb 中找到。

谢谢你

4

1 回答 1

22

覆盖active_for_authentication?模型中的方法 [...] —来源

因此,如果你有一个用户模型,你只需要做

class User

  def active_for_authentication?
    super && account_active?
  end

end
于 2013-04-07T18:12:44.673 回答