Week 3, NoMethodError in Users#index

I have no idea why but I’m receiving the following error after 1:53 into the week three video:

NoMethodError in Users#index
undefined method `each’ for nil:NilClass

app/views/users/index.html.erb contains the following:

  <%= @users.each do |user| %>
  <div><%= link_to user.username, user %></div>
  <% end %>

I tried to go from the begining of the video with no luck.

Check if @users was defined in your index action inside your controller.

    class UsersController < ApplicationController
      respond_to :html
    
      def index
        @user = User.all
      end
.
.
.
end

This should be @users. You have @user.

Ah, thanks! I was pulling my hair out.