lynndylanhurley / lynndylanhurley/devise_token_auth
Why mount_devise_token_auth_for did not pass the devise 'singular' option?
- Dominant language
- Ruby
- Stars
- 3.6k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
Looking at de `mount_devise_token_auth_for` method definition, when calling the `devise_for` method, there's no `singular` option that exists on devise. Why this is avoided? If applicable, i can work on this.
at lib/devise_token_auth/rails/routes.rb
```ruby
devise_for resource.pluralize.underscore.gsub('/', '_').to_sym,
class_name: resource,
module: :devise,
path: opts[:at].to_s,
controllers: controllers,
skip: opts[:skip] + [:omniauth_callbacks]
```
In my routes I have `mount_devise_token_auth_for 'User::ApiUser', at: 'auth', singular: 'api_user'`.
Expect to generate methods prefixed and suffixed with `api_user`, instead, got `user_api_user`.
* **Version**: 1.1.4
* **Request and response headers**: -
* **Rails Stacktrace**: -
* **Environmental Info**:
* **Routes**:` mount_devise_token_auth_for 'User::ApiUser', at: 'auth', singular: 'api_user'`
* **Gems**: Only ActiveRecord
* **Custom Overrides**: no
* **Custom Frontend**: no
Contributor guide
Research direction
Start in lib/devise_token_auth/rails/routes.rb at mount_devise_token_auth_for and its devise_for call. Compare the route options passed there with Devise's singular option, then reproduce the reported User::ApiUser route and inspect its generated helper names. Done means the requested singular value is handled consistently, or the limitation is documented by a focused test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- api, authentication
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100