Forum: Ruby on Rails unknown constant when using habtm?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
D429df409049c3ecf4a7d331838ba3d5?d=identicon&s=25 JamesR (Guest)
on 2007-04-06 17:59

I have a Post AR and a Category AR. The Post has_and_belongs_to_many
:Categories. When I attempt to call destroy() on a post object, I am
getting the following error.

uninitalized Constant Post::Categories.

It seems as if it should be using Post::Category and not
Post::Categories. For my other relationships, there is a constant there
in singular form. (ex: a post has_many :Links and there is a constant
called Post::Link).  There also exists a Post::Category constant..

Any ideas?

This topic is locked and can not be replied to.