devise
https://github.com/plataformatec/devise
Ruby
Flexible authentication solution for Rails with Warden.
Devise::Controllers::Helpers#after_sign_in_path_for
The default url to be used after signing in. This is used by all Devise
controllers and you can overwrite it in your ApplicationController to
provide a custom hook for a custom resource.
By default, it first tries to find a valid resource_return_to key in the
session, then it fallbacks to resource_root_path, otherwise it uses the
root path. For a user scope, you can define the default url in
the following way:
get '/users' => 'users#index', as: :user_root # creates user_root_path
namespace :user do
root 'users#index' # creates user_root_path
end
If the resource root path is not defined, root_path is used. However,
if this default is not enough, you can customize it, for example:
def after_sign_in_path_for(resource)
stored_location_for(resource) ||
if resource.is_a?(User) && resource.can_publish?
publisher_url
else
super
end
endEdit
git clone [email protected]:plataformatec/devise.git
cd devise
open lib/devise/controllers/helpers.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Devise--Controllers--Helpers-after_sign_in_path_for-for-pr
# Commit to gitgit add lib/devise/controllers/helpers.rbgit commit -m "better docs for Devise::Controllers::Helpers#after_sign_in_path_for"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Devise--Controllers--Helpers-after_sign_in_path_for-for-pr
hub pull-request
# Celebrate!