# Inflection issue

**URL:** <https://www.ruby-forum.com/t/inflection-issue/105050>\
**Category:** Rails\
**Created:** [May 25, 2007, 9:22am UTC](https://www.ruby-forum.com/t/inflection-issue/105050 "2007-05-25T09:22:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhishek\_Srivastava](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a183cd/32.png) [@Abhishek\_Srivastava](https://www.ruby-forum.com/u/Abhishek_Srivastava)\
**Post date:** [May 25, 2007, 9:22am UTC](https://www.ruby-forum.com/t/inflection-issue/105050/1 "2007-05-25T09:22:44Z")

</div>

Hi all,

I have a table called lenses for which i created the following  
inflection  
rule in environment.rb to support pluralization of lens.

Inflector.inflections do |inflect|  
inflect.plural(/(lens)$/i, ‘\1es’)  
end

Next I generated a scaffold for it

ruby script\generate scaffold admin::lens

But when I access the list view in browser I am getting the following  
error

NameError in Admin/lensesController#index

uninitialized constant Lense

RAILS\_ROOT: ./script/…/config/…  
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active\_support/dependencies.rb:266:in  
`load_missing_constant' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:452:in`const\_missing’  
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active\_support/dependencies.rb:464:in  
`const_missing' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/inflector.rb:250:in`constantize’  
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active\_support/core\_ext/string/inflections.rb:148:in  
`constantize' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/pagination.rb:195:in`paginator\_and\_collection\_for’  
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action\_controller/pagination.rb:130:in  
`paginate' #{RAILS_ROOT}/app/controllers/admin/lenses_controller.rb:12:in`list’  
#{RAILS\_ROOT}/app/controllers/admin/lenses\_controller.rb:3:in `index’

Can someone suggest a fix for this? What am I doing wrong?

Regards,  
Abhi

---

<div class="post-metadata">

**Author:** ![Abhishek\_Srivastava](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a183cd/32.png) [@Abhishek\_Srivastava](https://www.ruby-forum.com/u/Abhishek_Srivastava)\
**Post date:** [May 25, 2007, 10:19am UTC](https://www.ruby-forum.com/t/inflection-issue/105050/2 "2007-05-25T10:19:52Z")

</div>

Ah my bad.

changing it to this

Inflector.inflections do |inflect|  
inflect.irregular ‘lens’, ‘lenses’  
end

and restarting the application, fixed it.

Regards,  
Abhi

----- Original Message -----  
From: “Abhishek Srivastava” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Friday, May 25, 2007 4:05 PM  
Subject: [Rails] inflection issue
