undefined method `flash' for ActionDispatch::Request

前端 未结 3 1941
情歌与酒
情歌与酒 2020-12-08 20:14

I\'m trying to write an Ember application in Rails 4, and have decided to go with rails-api for the api controllers, while keeping the application controller in

相关标签:
3条回答
  • 2020-12-08 20:55

    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

    0 讨论(0)
  • 2020-12-08 21:05

    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

    0 讨论(0)
  • 2020-12-08 21:10

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

    Inside devise.rb change

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

    to:

    config.navigational_formats = [:json]
    

    or just [ ]

    0 讨论(0)
提交回复
热议问题