Inflector and AR model association class names

Was hoping someone might point me in the right direction here.

In environment.rb, I’ve an inflector rule like so:

inflect.irregular “serve”, “serves”

And a model User, with a habtm :serves

From the console, “serves”.singularize returns “serve.”

However, for any User u, calling u.serves throws:

NameError: uninitialized constant User::Serf

I’ve been using :class_name => ‘Serve’ option for the habtm
declaration as a workaround.

I’ve tried other inflector methods, and used namespaced strings like
“namespace::serve” but nothing seems to work.

What blows my mind is that the call to singularize works correctly,
but AR isn’t.

Thanks for any pointers.

I did post this to Rails Trac, and we’ve resorted to tabling this
issue, as I can’t replicate it with 2.0.2.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs