Refactor fix #4127
Refactor fix #4127

* Adding to check if rootpath is present on url_helpers.
* Run this code only for Rails versions lower than 5.1.

plataformatec/devise,rubyrider/devise,Qwiklabs/devise,rubyrider/devise,plataformatec/devise,rubyrider/devise,Qwiklabs/devise