undefined method `flash' for ActionDispatch::Request

余生长醉 提交于 2019-11-28 20:25:32

Not sure but maybe you need to include the ActionDispatch::Flash middleware to support the flash. Using:

config.middleware.use ActionDispatch::Flash

The docs says:

ActionDispatch::Flash: Supports the flash mechanism in ActionController.

I hope it helps

See: https://github.com/plataformatec/devise/issues/2775

Inside devise.rb change

config.navigational_formats = ['*/*', :html]

to:

config.navigational_formats = [:json]

or just [ ]

If you're like me and creating an API on top of an existing application, you can add this to your config/application.rb file:

config.api_only = false

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!