Required fields on confirmable
This commit is contained in:
parent
1bbae013cc
commit
6489354b0e
|
@ -36,6 +36,14 @@ module Devise
|
|||
after_update :send_confirmation_instructions, :if => :reconfirmation_required?
|
||||
end
|
||||
|
||||
module ModuleMethods
|
||||
extend self
|
||||
|
||||
def required_fields
|
||||
[:confirmation_token, :confirmed_at, :confirmation_sent_at]
|
||||
end
|
||||
end
|
||||
|
||||
# Confirm a user by setting it's confirmed_at to actual time. If the user
|
||||
# is already confirmed, add an error to email field. If the user is invalid
|
||||
# add errors
|
||||
|
|
|
@ -328,4 +328,12 @@ class ReconfirmableTest < ActiveSupport::TestCase
|
|||
admin = Admin.find_by_unconfirmed_email_with_errors(:email => "new_test@email.com")
|
||||
assert admin.persisted?
|
||||
end
|
||||
|
||||
test 'required_fields should contain the fields that Devise uses' do
|
||||
assert_equal Devise::Models::Confirmable::ModuleMethods.required_fields.sort, [
|
||||
:confirmation_sent_at,
|
||||
:confirmation_token,
|
||||
:confirmed_at
|
||||
]
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue