Create a column called is_active for the User model.
然后将下面的代码添加到 User模型中:
class User < ActiveRecord::Base
#this method is called by devise to check for "active" state of the model
def active_for_authentication?
#remember to call the super
#then put our own check to determine "active" state using
#our own "is_active" column
super and self.is_active?
end
end
更新
As Matt Huggins notes, the method is now called active_for_authentication? (文件)