Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for devise devise_group ? #328

Open
feliperaul opened this issue Feb 16, 2018 · 0 comments
Open

Support for devise devise_group ? #328

feliperaul opened this issue Feb 16, 2018 · 0 comments
Labels
feature request This issue requests a new feature.

Comments

@feliperaul
Copy link

Devise has a handy feature called devise_group (documentation), which creates a group with your multiple devise models.

The docs are really self explanatory. If you have 2 devise models named, for instance, Admin and User, you can use devise_group like so:


class ApplicationController < ActionController::Base
  devise_group :blogger, contains: [:user, :admin]
end

This gives us, alongside with authenticate_user! and authenticate_admin!, the method authenticate_blogger!, which would redirect unless user or admin were signed in.

If I understood correctly from the docs, the gem's official way of supporting multiple models would require to declare multiple lines like this:

acts_as_token_authentication_handler_for Admin, fallback: :none
acts_as_token_authentication_handler_for User

Since this repetition is not, imho, very DRY (specially with the only and except filters), and also prone to errors, my request is that the gem (due to having close Devise integration) supports an API like this:

acts_as_token_authentication_handler_for_group :blogger

or even

acts_as_token_authentication_handler_for :group, name: :blogger

What do you guys think?

@gonzalo-bulnes gonzalo-bulnes added the feature request This issue requests a new feature. label Jan 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request This issue requests a new feature.
Projects
None yet
Development

No branches or pull requests

2 participants