# Inflector and AR model association class names

**URL:** <https://www.ruby-forum.com/t/inflector-and-ar-model-association-class-names/130990>\
**Category:** Rails\
**Created:** [March 5, 2008, 12:27am UTC](https://www.ruby-forum.com/t/inflector-and-ar-model-association-class-names/130990 "2008-03-05T00:27:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tshim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c4cdca/32.png) [@tshim](https://www.ruby-forum.com/u/tshim)\
**Post date:** [March 5, 2008, 12:27am UTC](https://www.ruby-forum.com/t/inflector-and-ar-model-association-class-names/130990/1 "2008-03-05T00:27:05Z")

</div>

Was hoping someone might point me in the right direction here.

In environment.rb, I’ve an inflector rule like so:

inflect.irregular “serve”, “serves”

And a model User, with a habtm :serves

From the console, “serves”.singularize returns “serve.”

However, for any User u, calling u.serves throws:

NameError: uninitialized constant User::Serf

I’ve been using :class\_name =\> ‘Serve’ option for the habtm  
declaration as a workaround.

I’ve tried other inflector methods, and used namespaced strings like  
“namespace::serve” but nothing seems to work.

What blows my mind is that the call to singularize works correctly,  
but AR isn’t.

Thanks for any pointers.

---

<div class="post-metadata">

**Author:** ![tshim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c4cdca/32.png) [@tshim](https://www.ruby-forum.com/u/tshim)\
**Post date:** [April 9, 2008, 12:24am UTC](https://www.ruby-forum.com/t/inflector-and-ar-model-association-class-names/130990/2 "2008-04-09T00:24:50Z")

</div>

I did post this to Rails Trac, and we’ve resorted to tabling this  
issue, as I can’t replicate it with 2.0.2.
