'Devise flash messages not working with Turbo
I'm running Rails 6.1.4.4 with Devise 4.8.1 and configured my setup to use importmaps and hotwire-rails. When logging in through Devise I no longer get a flash message.
I do get flash messages on other parts of the system.
In the devise controller I can see the flash message being created, but nothing appears in the browser.
def set_flash_message(key, kind, options = {})
message = find_message(kind, options)
if options[:now]
flash.now[key] = message if message.present?
else
flash[key] = message if message.present?
end
end
I do have the following in my application.html.erb layout
<div id="notice" class="alert alert-info">
<%= notice %>
</div>
In my controllers I have flash messages working like so;
def create
@wine = current_user.wines.new(wine_params)
if @wine.save
redirect_to wines_path, notice: "Wine was successfully created."
else
render :new
end
end
What do I have to do to get Devise displaying the flash messages on successful/unsuccessful login?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
