Plural to singular blunder

I just got this error:

uninitialized constant PriceCurf

After much head scratching I remembered the Rails plural to singular
mapping rules. My table is price_curves, my object is PriceCurve …
whereas I am guessing Rails thinks the singular ought to br PriceCurf
?!

I’m sure there is a simple way around this linguistic blunder that
doesn’t involve the use of pigeon English.

Funny though.

Sean B. wrote:

doesn’t involve the use of pigeon English.

Funny though.

Check http://api.rubyonrails.org/classes/Inflector/Inflections.html to
see how you can add exceptions to the rules Rails uses for the
tranformations from class to table names and such…

Michael

Just adding the :class_name parameter seems to override the default
inference. That’s a very acceptable work around.

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