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: <p>
25: <b>Categoria:</b><br/>
26: <select name="recipe[category_id]">
27: <% @categories.each do |category| %>
28: <option value="<%= category.id %>">
29: <%= category.name %>
30: </option>
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.
=====