[newbie]problem when using validates*

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

Antonio

=====
Por favor, si me mandas correos con copia a varias personas,
pon mi dirección de correo en copia oculta (CCO), para evitar
que acabe en montones de sitios, eliminando mi privacidad,
favoreciendo la propagación de virus y la proliferación del SPAM. Gracias.

If you send me e-mail which has also been sent to several other people,
kindly mark my address as blind-carbon-copy (or BCC), to avoid its
distribution, which affects my privacy, increases the likelihood of
spreading viruses, and leads to more SPAM. Thanks.