[RUBY] NameError in Income # index error

On creating a household account book application

NameError in Incomes#index

I got the error

index.html.erb


<% @page_title = "List of income subjects" %>
<h2><%= page_title %></h2>

<% if @incomes.present? %>
<table>
    <thead>
        <tr>
            <th>subject name</th>
            <th>Remarks</th>
        </tr>
    </thead>
    <tbody>
        <% @incomes.each do |income| %>
            <tr>
                <td><%= income.name %></td>
                <td><%= income.description %></td>
            </tr>
        <% end %>
    </tbody>
</table>

<% else %>
    <p>There are no registered courses</p>
<% end %>

If you take a closer look, ...

Before page on the second line

@

Isn't it missing?

index.html.erb



<h2><%= @page_title %></h2>

This is the correct error resolution. It's a problem because you get an error due to a typo or a small omission, programming.

Especially for me as a beginner.

I will continue to do my best while fighting errors

Recommended Posts

NameError in Income # index error
Error handling in Graphql-ruby
ActiveRecord :: NotNullViolation in Devise error
Error in rails db: migrate
npm error in docker tutorial
Error in Spring database connection
[Rails] Unexpected validation error in devise
About Invalid Request Error in Payjp
411 Error: Length Required in SOAP communication
Error handling in gRPC (Kotlin version)
Error in ./gradlew: Symbol not found
Error summary in bundle install. memorandum
Error encountered in tagging function implementation
[Ruby] Summary of exception classes that appear in error statements [Meaning of NameError]