Agile Web Development with Rails 7 (version P1.0): mismatched alert to notice for session's controller/view (page 212)

Hello,

While trying to use the login authentication feature implemented on page 211 (iteration I2), I noticed that the flash notice we added on page 212 for the session’s new.html.erb view does not work (for me at least), it does not show up for me when attempting a login with the wrong credentials.

Right before the snippet of code for this view on page 212, is a snippet of code for the session’s controller. I noticed the controller uses a flash alert, instead of a notice, as an option for its redirect_to under the user&.authenticate conditional.

Changing the view to match the controller’s redirect_to options fixed this for me.

Replacing:

<%= if notice.present? %>
#…
<% notice %>

With:

<%= if alert.present? %>
#…
<% alert %>

The reverse also worked, updating the controller instead to use notice as an option to match the code in the view.

Not sure if this wasn’t working for anyone else, but wanted to share just in case.