Closed swiedaa1 closed 10 years ago
Looks like that last <% end %>
is not needed.
In these situations, I like to to delete everything in the file and refresh the page. If the error goes away, slowly add back sections of the file until the error comes back. That helps narrow down where the error is coming from.
Alright, killing that did nothing so I'm trying to go back a few steps.
No I am getting this when I go to : http://swiedaa1-72810.use1.nitrousbox.com/user/ I'm not sure why it says I havent defined .each because I thought that was defined by ruby?
In this case, Rails is telling you that the instance variable @posts
has not been defined. In your UsersController you need to set an instance variable in the index
method so that it can be used by the view. Probably you're doing something like @users = User.all
in your controller and you just need to user @users
instead of @posts
in the view.
So, in trying to make my users/new work, I somehow messed up my posts/new. I'm terrible confused because I receive this error. I've gone through the file more times than I can count and I have the appropriate number of ends.
Thanks
Trying to use: http://swiedaa1-72810.use1.nitrousbox.com/posts/new
Code for _form.html.erb:
<% link_to 'Edit', edit_post_path(@post) %>
`<% if @post.errors.any? %>
<%= pluralize(@post.errors.count, "error") %> prohibited this student from being added:
<% @post.errors.full_messages.each do |msg| %>- <%= msg %>
<% end %>
<% end %>
<%= f.label :name %>
<%= f.text_field :name %>
<%= f.label :nickname %>
<%= f.text_field :nickname %>
<%= f.label :email %>
<%= f.text_field :email %>
<%= f.label :image %>
<%= f.text_area :image %>
<%= f.submit %>
<% end %>`