Hotwire form failures and flash

I think this is a bit of a newbie question but I’m struggling to do some basic stuff after adding Hotwire. I possibly shouldn’t have added it yet because I’m not actively/deliberately using any of its features but I assumed I could add it to the app and then gradually opt in to extra functionality.

Here’s what I’ve done so far:

  • brand new Rails 6.1.3 app created with rails new my_app -d postgresql
  • replaced turbolinks gem with hotwire-rails (version 0.1.3 according to Gemfile.lock)
  • ran ./bin/rails hotwire:install
  • added flash message display to the main layout
  • created a pretty standard log in system


  get    '/sign_in',   to: 'sessions#new'
  post   '/sign_in',   to: 'sessions#create'
  delete '/sign_out',  to: 'sessions#destroy'


module SessionsHelper
  def sign_in(user)
    session[:user_id] =

  def current_user
    @current_user ||= Staff.find_by(id: session[:user_id]) if session[:user_id]

  def signed_in?

  def sign_out
    @current_user = nil


  def create
    user = Staff.find_by(school_email: params[:session][:email].downcase)
    if user && user.authenticate(params[:session][:password])
      sign_in user
      redirect_to (cookies[:return_to] || root_url), notice: 'Welcome!'
      cookies[:return_to] = nil
    else[:alert] = 'Email address not found or password doesn't match'
      render 'new', status: :unprocessable_entity

I’m now trying to do fairly standard things that I used to be able to do and running into issues, particularly around form submissions, errors and flash. Sign in and out work but failed sign in attempts aren’t behaving the way I’m used to.

Before adding status: :unprocessable_entity on the failed attempt there was no feedback to suggest sign in failed (no flash message and no re-rendering). Since adding that I can at least get the failed sign in to render but the flash messages still won’t show up.

Should I just opt out of Turbo for this form? Or am I completely misunderstanding what Hotwire does? Perhaps I should remove it until there’s some more help out there for novices and newbs?