NoMethodError in Classified#create nil object

As a matter a fact, the error is related to the validation itself. It 'crashes' on the relation category-classified. So far I found out that the error is introduced in chapter 5 after adding the relation category-classified. It has nothing to do with file upload. If you remove the validations from the model it all works fine.

So far, the author hasn't come back with an answer to fix it. Ideally, you should be able to trap the errors

Anybody got an idea how to overcome this? APparantly, the Ruby code tries to retrieve associated records from a category, without having an instantiated classifieds array.

Hi, finally I found the solution for this problem, as Marcel Dohmen said, the validation crashes on relation category-classified, defined on classified.rb. just change "belongs_to :category", after all the validations.

I hope it works to you.

PD: Sorry about my english,