devise
https://github.com/plataformatec/devise
Ruby
Flexible authentication solution for Rails with Warden.
ActionDispatch::Routing::Mapper#authenticate
Allow you to add authentication request from the router.
Takes an optional scope and block to provide constraints
on the model instance itself.
authenticate do
resources :post
end
authenticate(:admin) do
resources :users
end
authenticate :user, lambda {|u| u.role == "admin"} do
root to: "admin/dashboard#show", as: :user_root
endEdit
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-authenticate-for-pr
# Commit to gitgit add lib/devise/rails/routes.rbgit commit -m "better docs for ActionDispatch::Routing::Mapper#authenticate"
# 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-authenticate-for-pr
hub pull-request
# Celebrate!