Yield the resource being registered to block if passed in

Taken from
https://github.com/plataformatec/devise/commit/989071144e80cea01be2ac357730ce98260353bc