NoMethodError in Recipe#index

I’m trying to teach myself Ruby on Rails, and doing the infamous
Cookbook as a starting point. I’m all set until the point when I go to
create of sumbit my recipe and I get this error:

NoMethodError in Recipe#index

You have a nil object when you didn’t expect it!
The error occured while evaluating nil.name

15: <% @recipes.each do |recipe| %>
16:


17: <%= link_to recipe.title, :action => “show”, :id => recipe.id
%>
18: <%= recipe.category.name %>
19: <%= recipe.date %>
20:
21: <% end %>

when I look in my MySQL database, the recipe is indeed in the db, but I
still get that error. Any help would be greatly appreciated.

Nick

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs