plataformatec/devise — pull request #1908 by mhfs (2012-06-11 21:03:49+00:00)
Title: Persist unlock token before triggering mailer

Hey guys,

The fact that the lockable module triggers the email before the token is persisted is annoying me in some specs when associated with devise-async.

Also, even tough very unlikely, the current code would allow a worker to have a tiny time frame in which it would be able to render the email before the token is persisted (devise-async loads the record from db).

This change just ensures the token is persisted before triggering the mailer.

Let me know if you need any change.

Cheers!