devise
https://github.com/plataformatec/devise
Ruby
Flexible authentication solution for Rails with Warden.
ActionDispatch::Routing::Mapper#devise_scope
Sets the devise scope to be used in the controller. If you have custom routes,
you are required to call this method (also aliased as :as) in order to specify
to which controller it is targetted.
as :user do
get "sign_in", to: "devise/sessions#new"
end
Notice you cannot have two scopes mapping to the same URL. And remember, if
you try to access a devise controller without specifying a scope, it will
raise ActionNotFound error.
Also be aware of that 'devise_scope' and 'as' use the singular form of the
noun where other devise route commands expect the plural form. This would be a
good and working example.
devise_scope :user do
get "/some/route" => "some_devise_controller"
end
devise_for :users
Notice and be aware of the differences above between :user and :usersEdit
git clone [email protected]:plataformatec/devise.git
cd devise
open lib/devise/rails/routes.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-ActionDispatch--Routing--Mapper-devise_scope-for-pr
# Commit to gitgit add lib/devise/rails/routes.rbgit commit -m "better docs for ActionDispatch::Routing::Mapper#devise_scope"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-ActionDispatch--Routing--Mapper-devise_scope-for-pr
hub pull-request
# Celebrate!