Devise :: Confirmable verwendet die Spalte datatime Spalte confirmed_at
.
# Confirmable tracks the following columns:
#
# * confirmation_token - A unique random token
# * confirmed_at - A timestamp when the user clicked the confirmation link
# * confirmation_sent_at - A timestamp when the confirmation_token was generated (not sent)
# * unconfirmed_email - An email address copied from the email attr. After confirmation
# this value is copied to the email attr then cleared
Da die Spalte auf NULL festlegbare die Implementierungen ist so einfach wie:
module Devise
module Models
module Confirmable
# ...
def confirmed?
!!confirmed_at
end
end
end
end
Welche weil in Ruby alles funktioniert außer null und falsch wahr sind. Das Setzen von confirmed_at
auf ein beliebiges Datetime (auch in der Zukunft) wird den Datensatz bestätigen.
module Devise
module Models
module Confirmable
# If you don't want confirmation to be sent on create, neither a code
# to be generated, call skip_confirmation!
def skip_confirmation!
self.confirmed_at = Time.now.utc
end
end
end
end
Von the Devise source.
Spalte 'confirmed_at' in' users' Tabelle. –