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