sign_in: extract the procedure context to a ProcedureContextConcern

This commit is contained in:
Pierre de La Morinerie 2019-01-14 16:25:48 +01:00
parent e580d336e4
commit 4fd9fa6610
7 changed files with 147 additions and 54 deletions

View file

@ -1,6 +1,15 @@
module Devise
# Useful helpers additions to Devise::Controllers::StoreLocation
module StoreLocationExtension
# A variant of `stored_location_key_for` which doesn't delete the stored path.
def get_stored_location_for(resource_or_scope)
location = stored_location_for(resource_or_scope)
if location
store_location_for(resource_or_scope, location)
end
location
end
# Delete the url stored in the session for the given scope.
def clear_stored_location_for(resource_or_scope)
session_key = send(:stored_location_key_for, resource_or_scope)