Inflection issue

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:inconst_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:inconstantize’
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:inpaginator_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:inlist’
#{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

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” [email protected]
To: [email protected]
Sent: Friday, May 25, 2007 4:05 PM
Subject: [Rails] inflection issue