mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Added mention of API mode complications to README (#5041) [ci skip]
This commit is contained in:
parent
1102600720
commit
2f3a59640b
1 changed files with 12 additions and 0 deletions
12
README.md
12
README.md
|
@ -56,6 +56,7 @@ It's composed of 10 modules:
|
|||
- [ActiveJob Integration](#activejob-integration)
|
||||
- [Password reset tokens and Rails logs](#password-reset-tokens-and-rails-logs)
|
||||
- [Other ORMs](#other-orms)
|
||||
- [Rails API mode](#rails-api-mode)
|
||||
- [Additional information](#additional-information)
|
||||
- [Heroku](#heroku)
|
||||
- [Warden](#warden)
|
||||
|
@ -694,6 +695,17 @@ config.log_level = :warn
|
|||
|
||||
Devise supports ActiveRecord (default) and Mongoid. To select another ORM, simply require it in the initializer file.
|
||||
|
||||
### Rails API Mode
|
||||
|
||||
Rails 5+ has a built-in [API Mode](https://edgeguides.rubyonrails.org/api_app.html) which optimizes Rails for use as an API (only). One of the side effects is that it changes the order of the middleware stack, and this can cause problems for `Devise::Test::IntegrationHelpers`. This problem usually surfaces as an ```undefined method `[]=' for nil:NilClass``` error when using integration test helpers, such as `#sign_in`. The solution is simply to reorder the middlewares by adding the following to test.rb:
|
||||
|
||||
```ruby
|
||||
Rails.application.config.middleware.insert_before Warden::Manager, ActionDispatch::Cookies
|
||||
Rails.application.config.middleware.insert_before Warden::Manager, ActionDispatch::Session::CookieStore
|
||||
```
|
||||
|
||||
For a deeper understanding of this, review [this issue](https://github.com/plataformatec/devise/issues/4696).
|
||||
|
||||
## Additional information
|
||||
|
||||
### Heroku
|
||||
|
|
Loading…
Reference in a new issue