Forum: Ruby on Rails plural to singular blunder

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ff7c968ec96d769974df09dc453eb746?d=identicon&s=25 Sean Blezard (Guest)
on 2006-03-28 14:57
(Received via mailing list)
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.
1e90246fc67e699c32e59db89d4ff5c3?d=identicon&s=25 Michael Kaiser (Guest)
on 2006-03-28 15:07
(Received via mailing list)
Sean Blezard wrote:
> doesn't involve the use of pigeon English.
>
> Funny though.

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

Michael
Ff7c968ec96d769974df09dc453eb746?d=identicon&s=25 Sean Blezard (Guest)
on 2006-03-28 15:10
(Received via mailing list)
Just adding the :class_name parameter seems to override the default
inference. That's a very acceptable work around.
This topic is locked and can not be replied to.