Ruby on rails 如何设计可锁定模块

Ruby on rails 如何设计可锁定模块,ruby-on-rails,devise,Ruby On Rails,Devise,我试图覆盖可锁定模块以支持Desive token auth,但它没有覆盖。我到处找,什么也没找到。我想我错过了什么,但我不知道是什么。任何帮助都将不胜感激 module Lockable extends Devise::Models::Lockable def valid_for_authentication? # My code end end 在您的Desive model用户中扩展并包含模块的Drop,是吗 module MyLockable def vali

我试图覆盖可锁定模块以支持Desive token auth,但它没有覆盖。我到处找,什么也没找到。我想我错过了什么,但我不知道是什么。任何帮助都将不胜感激

module Lockable extends Devise::Models::Lockable

  def valid_for_authentication?
    # My code 
  end

end
在您的Desive model用户中扩展并包含模块的Drop,是吗

module MyLockable
  def valid_for_authentication? # or whatever
    ...
  end
end

class User
  include MyLockable
end
或者,您可以直接在用户中定义该方法

class User
  def valid_for_authentication?
    ...
  end
end
在您的Desive model用户中扩展并包含模块的Drop,是吗

module MyLockable
  def valid_for_authentication? # or whatever
    ...
  end
end

class User
  include MyLockable
end
或者,您可以直接在用户中定义该方法

class User
  def valid_for_authentication?
    ...
  end
end