Skip to content

Commit e033121

Browse files
Merge pull request #54 from graphql-devise/fix-alias-concerns
Fix concern aliases
2 parents 3310c33 + b13d83a commit e033121

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,16 @@ class User < ApplicationRecord
121121
:confirmable
122122

123123
# including after calling the `devise` method is important.
124+
# include DeviseTokenAuth::Concerns::User # is also valid (generator includes this one).
124125
include GraphqlDevise::Concerns::Model
125126
end
126127
```
127128

128129
The install generator can do this for you if you specify the `user_class` option.
129130
See [Installation](#Installation) for details.
131+
The generator will include a different module in your model, `DeviseTokenAuth::Concerns::User` which is also correct,
132+
we just made an alias on our namespace for consistency and possible extension.
133+
Generators have to be updated to generate our module.
130134

131135
### Customizing Email Templates
132136
The approach of this gem is a bit different from DeviseTokenAuth. We have placed our templates in `app/views/graphql_devise/mailer`,
@@ -145,6 +149,9 @@ In our example our model is `User`, so it would look like this:
145149
# app/controllers/my_controller.rb
146150

147151
class MyController < ApplicationController
152+
# include DeviseTokenAuth::Concerns::SetUserByToken # is also valid (generator includes this one).
153+
include GraphqlDevise::Concerns::SetUserByToken
154+
148155
before_action :authenticate_user!
149156

150157
def my_action
@@ -155,6 +162,9 @@ end
155162

156163
The install generator can do this for you because it executes DTA installer.
157164
See [Installation](#Installation) for details.
165+
The generator will include a different module in your model, `DeviseTokenAuth::Concerns::SetUserByToken` which is also correct,
166+
we just made an alias on our namespace for consistency and possible extension.
167+
Generators have to be updated to generate our module.
158168

159169
### Making Requests
160170
Here is a list of the available mutations and queries assuming your mounted model is `User`.

app/controllers/graphql_devise/concerns/set_user_by_token.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
require 'devise_token_auth/concerns/set_user_by_token'
2-
31
module GraphqlDevise
42
module Concerns
53
SetUserByToken = DeviseTokenAuth::Concerns::SetUserByToken

app/models/graphql_devise/concerns/model.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
require 'devise_token_auth/concerns/user'
2-
31
module GraphqlDevise
42
module Concerns
53
Model = DeviseTokenAuth::Concerns::User

0 commit comments

Comments
 (0)