redirect users back to most recently viewed page after login

user story https://www.pivotaltracker.com/story/show/64997344
based on recommendations at the devise wiki
https://github.com/plataformatec/devise/wiki/How-To:-Redirect-back-to-current-page-after-sign-in,-sign-out,-sign-up,-update
with slight modifications to request paths that are ignored in the store location method.
the reason there are two methods is that the when /user/password/edit gets called the users name is appended to the end which is why I was using regexp rather than equality. One method would be good but using route helpers would still have the same problem for the edit_user_password path. 
Does anyone have any suggestions?