When I create my code below, it returns me this error message, saying that my method is undefined for nil
(undefined method 'errors' for nil:NilClass)
Code:
<ul>
<% @task.errors.full_messages.each do |message| %>
<li><%= message %></li>
<%end%>
</ul>
<%=form_for @task do |f|%>
<%=f.label :description, 'Descrição'%>
<%=f.text_field :description%>
<%=f.label :status, 'Status'%>
<%=f.check_box :status%>
<%=f.submit 'Criar'%>
<%end%>