家計簿アプリ作成の上で
NameError in Incomes#index
のエラーが出ました
index.html.erb
<% @page_title = "収入科目一覧" %>
<h2><%= page_title %></h2>
<% if @incomes.present? %>
<table>
<thead>
<tr>
<th>科目名</th>
<th>備考</th>
</tr>
</thead>
<tbody>
<% @incomes.each do |income| %>
<tr>
<td><%= income.name %></td>
<td><%= income.description %></td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<p>登録されている科目がありません</p>
<% end %>
よく見てみると、、、
2行目のpageの前
@
が抜けているではないか。
index.html.erb
<h2><%= @page_title %></h2>
これで無事エラー解消です。
タイプミスとか、少しの抜けとかでエラーになっちゃうから困りますよね、プログラミングというものは。
初心者の私は特に。
エラーと闘いながら、今後も引き続き頑張ります