# Singularize Pluralize "tax"

**URL:** <https://www.ruby-forum.com/t/singularize-pluralize-tax/88572>\
**Category:** Rails\
**Created:** [March 12, 2007, 7:30pm UTC](https://www.ruby-forum.com/t/singularize-pluralize-tax/88572 "2007-03-12T19:30:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 12, 2007, 7:30pm UTC](https://www.ruby-forum.com/t/singularize-pluralize-tax/88572/1 "2007-03-12T19:30:26Z")

</div>

I have a table: municipal\_taxes and a model: MunicipalTax  
which belongs\_to :company  
Company has\_many :municipal\_taxes

I get this error:  
NameError: uninitialized constant Company::MunicipalTaxis  
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/  
active\_support/dependencies.rb:477:in `const\_missing’

When I open up the console I see that:

“tax”.pluralize # =\> “taxes”  
“taxes”.singularize # =\> “taxis”  
“taxis”.pluralize # =\> “taxes”  
“taxis”.singularize # =\> “taxi”

I corrected this with the Inflector in environment.rb but why might  
this be happening?

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 12, 2007, 7:37pm UTC](https://www.ruby-forum.com/t/singularize-pluralize-tax/88572/2 "2007-03-12T19:37:26Z")

</div>

The inflector isn’t perfect; a few attempts have been made to add a  
few things, but the typical response is deal with it in  
environment.rb. It’s getting “taxes” =\> “taxis” from the regex that  
says “axes” =\> “axis.”

You did the right thing (in the Rails core team’s opinion) by  
addressing it in environment.rb. 🙂

–Jeremy

On 3/12/07, removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> When I open up the console I see that:
> 
> >

–  
[http://www.jeremymcanally.com/](http://www.jeremymcanally.com/)

My free Ruby e-book:  
[http://www.humblelittlerubybook.com/book/](http://www.humblelittlerubybook.com/book/)

My blogs:

> **[Site not found · DreamHost](http://www.mrneighborly.com/)**
>
> The owner of this domain has not yet uploaded their website.

[http://www.rubyinpractice.com/](http://www.rubyinpractice.com/)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 12, 2007, 7:52pm UTC](https://www.ruby-forum.com/t/singularize-pluralize-tax/88572/3 "2007-03-12T19:52:28Z")

</div>

As a workaround you can always use the :class\_name and :foreign\_key  
options also to override the default naming.

Michael

On Mar 12, 11:29 am, “removed\_email\_address@domain.invalid”
