# Unknown constant when using habtm?

**URL:** <https://www.ruby-forum.com/t/unknown-constant-when-using-habtm/91316>\
**Category:** Rails\
**Created:** [April 6, 2007, 5:59pm UTC](https://www.ruby-forum.com/t/unknown-constant-when-using-habtm/91316 "2007-04-06T17:59:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JamesR](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a9a28c/32.png) [@JamesR](https://www.ruby-forum.com/u/JamesR)\
**Post date:** [April 6, 2007, 5:59pm UTC](https://www.ruby-forum.com/t/unknown-constant-when-using-habtm/91316/1 "2007-04-06T17:59:11Z")

</div>

Hello,

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?

-jr
