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"
<abhi_sri-hi6Y0CQ0nG0@public.gmane.org>
To: <rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Sent: Friday, May 25, 2007 4:05 PM
Subject: [Rails] 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: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
>
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---