devise

https://github.com/plataformatec/devise

Ruby

Flexible authentication solution for Rails with Warden.

Devise::Controllers::Helpers.define_helpers

Define authentication filters and accessor helpers based on mappings.
These filters should be used inside the controllers as before_actions,
so you can control the scope of the user who should be signed in to
access that specific controller/action.
Example:

  Roles:
    User
    Admin

  Generated methods:
    authenticate_user!  # Signs user in or redirect
    authenticate_admin! # Signs admin in or redirect
    user_signed_in?     # Checks whether there is a user signed in or not
    admin_signed_in?    # Checks whether there is an admin signed in or not
    current_user        # Current signed in user
    current_admin       # Current signed in admin
    user_session        # Session data available only to the user scope
    admin_session       # Session data available only to the admin scope

  Use:
    before_action :authenticate_user!  # Tell devise to use :user map
    before_action :authenticate_admin! # Tell devise to use :admin map

Source | Google | Stack overflow

Edit

git clone [email protected]:plataformatec/devise.git

cd devise

open lib/devise/controllers/helpers.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Devise--Controllers--Helpers-define_helpers-for-pr


# Commit to git

git add lib/devise/controllers/helpers.rbgit commit -m "better docs for Devise::Controllers::Helpers.define_helpers"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Devise--Controllers--Helpers-define_helpers-for-pr

hub pull-request


# Celebrate!