Hi,
I have performed the cookbook tutorial. Before tailoring the views and
controllers, when I put in the model recipe.rb:
validates_uniqueness_of :title
validates_length_of :title, :within => 1…20
And I tried to introduce some new recipe without the above conditions I
got the message:
New recipe
1 error prohibited this category from being saved
There were problems with the following fields:
* Name is too short (minimum is 1 characters)
Name
Back
So, just fine. But after tailoring the views and controller I’m not
longer able to get this, just this one:
NoMethodError in Recipe#create
Showing app/views/recipe/new.rhtml where line #27 raised:
You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.each
Extracted source (around line #27):
24:
25: Categoria:
26:
27: <% @categories.each do |category| %>
28:
29: <%= category.name %>
30:
Why the sentences in the model
Some ideas?
BR