Reputation: 65
currently working on my project.and
i'm trying to create an existing article page but i keep getting this message
undefined method `errors' for nil: Nil Class. currently working on my project
Edit existing article
<% [email protected]? %>
<h>The following errors prevented the article from getting created</h>
<ul>
<%@article.errors.full_messages.each do |msg| %
Upvotes: 0
Views: 181
Reputation: 576
@article
doesn't exist. It's probably expected that your controller is setting this variable, and you haven't done that (or it's failing to get a value for some other reason).
Note that the places errors
exists in your code snippet are method calls (x.y
implies y
is a method on the object x
in Ruby). This is how to identify this problem in the future.
Upvotes: 1