I get error : You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.category_id
So i have 3 tables categories, items, notes
Items belongs to category and note, so I have add those to the model
of item. Do i have to add category model has_many Items call also?
I get error : You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.category_id
You use @item.category_id here without assigning anything to @item, so
it’s nil
So i have 3 tables categories, items, notes
Items belongs to category and note, so I have add those to the model
of item. Do i have to add category model has_many Items call also?
Yes, Category needs a
has_many :items
if Items defined
belongs_to :category
Shouldn’t note belong_to Item instead the other way around?
I just assume this from the name, you may know better.