# Inflector problem?

**URL:** <https://www.ruby-forum.com/t/inflector-problem/107245>\
**Category:** Rails\
**Created:** [June 19, 2007, 4:23pm UTC](https://www.ruby-forum.com/t/inflector-problem/107245 "2007-06-19T16:23:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![emmanueloga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ecae2f/32.png) [@emmanueloga](https://www.ruby-forum.com/u/emmanueloga)\
**Post date:** [June 19, 2007, 4:23pm UTC](https://www.ruby-forum.com/t/inflector-problem/107245/1 "2007-06-19T16:23:55Z")

</div>

Hi, i think i have an inflector problem, 'cause my “has\_many through”  
association is failing like this:

Mysql::Error: #42S22Unknown column  
‘prod\_thicknesses\_prod\_codes\_join.prod\_thicknes\_id’ in ‘on clause’:

## SELECT count(DISTINCT prod\_codes.id) AS count\_all FROM prod\_codes LEFT OUTER JOIN products ON (prod\_codes.`id` = products.`prod_code_id`) LEFT OUTER JOIN prod\_formats ON (prod\_formats.`id` = products.`prod_format_id`) LEFT OUTER JOIN products prod\_thicknesses\_prod\_codes\_join ON (prod\_codes.`id` = prod\_thicknesses\_prod\_codes\_join.`prod_code_id`) LEFT OUTER JOIN prod\_thicknesses ON (prod\_thicknesses.`id` = prod\_thicknesses\_prod\_codes\_join.`prod_thicknes_id`) LEFT OUTER JOIN products products\_prod\_codes ON products\_prod\_codes.prod\_code\_id = prod\_codes.id

In the SQL clause, ‘prod\_thicknes\_id’ should read like  
‘prod\_thickness\_id’ (extra ‘s’ at the word’s end). I tried to manually  
inflect the correct behavior but nothing happens!:

enviroment.rb:  
…  
Inflector.inflections do |inflect|

# inflect.plural /^(ox)$/i, ‘\1en’

# inflect.singular /^(ox)en/i, ‘\1’

# inflect.irregular ‘person’, ‘people’

```
inflect.irregular 'thickness', 'thicknesses'
inflect.irregular 'prod_thickness', 'prod_thicknesses'

```

end

What should i do???

Thanks!

---

<div class="post-metadata">

**Author:** ![emmanueloga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ecae2f/32.png) [@emmanueloga](https://www.ruby-forum.com/u/emmanueloga)\
**Post date:** [June 20, 2007, 12:22am UTC](https://www.ruby-forum.com/t/inflector-problem/107245/2 "2007-06-20T00:22:04Z")

</div>

On 6/19/07, Emmanuel O. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> # inflect.plural /^(ox)$/i, ‘\1en’
> 
> # inflect.singular /^(ox)en/i, ‘\1’
> 
> # inflect.irregular ‘person’, ‘people’
> 
> ```
> inflect.irregular 'thickness', 'thicknesses'
> inflect.irregular 'prod_thickness', 'prod_thicknesses'
> 
> ```
> 
> end
> 
> What should i do???

First hackish thought:

Inflector.inflections do |inflect|  
inflect.plural ‘thickness’, ‘thicknesses’  
inflect.singular ‘thickness’, ‘thickness’  
inflect.singular ‘thicknesses’, ‘thickness’  
inflect.plural ‘thicknesses’, ‘thicknesses’  
end
