Naming confusion



I have a database setup with 2 tables and a simple one-to-many
relationship where
article_categories have many articles.

In the models ruby has created for me, I’ve added “belongs_to
:article_category” to the Article class and “has_many :articles” to
the ArticleCategory class.

Everything seems fine until I try to reference the category from the
article. In my view for example, I have”, but this throws an error…

You have a nil object when you didn’t expect it!
The error occured while evaluating

The referential integrity is fine. I imagine having an categories
table as opposed to article_categories may help, but I have other
types of categories in my database.

Any pointers would be a great help.

Thanks in advance,

#2”, but this throws an error…
Any pointers would be a great help.
I managed to solve the problem after a little more poking.

I’d incorrectly named the article_category_id column in the article
table as category_id. All works fine now.