hello, i''m new to Camping and i dont speek english very well so , please, forgive my mistakes...here is my question: i want to modify the way active record Pluralize/singularize my tables names. i have 2 classes: module Todo::models class Tache <Base belongs_to :categorie end class Categorie< Base has_many :taches end end "tache" and "categorie" are french words. their plural form are "taches" and "categories ". when i write: ... maCategorie=Categorie.create(:nom => categorie) maCategorie.taches.create(:nom => nomPropre) ... I have an "unitialized constant Todo::Models::Categorie::Tach" error message. i think activerecord infers that the singular for "taches" is "tach" instead of "tache". or maybe it''s something else. any idea ? thanks Fran?ois -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20130322/2634a38a/attachment.html>
Hey Fran?ois, I would advice you to use English terms even though it''s not your mother tongue. However, if you must, it''s pretty easy to add custom inflections: ActiveSupport::Inflector.inflections do |inflect| inflect.irregular ''tach'', ''tache'' end See here for more examples: http://api.rubyonrails.org/classes/ActiveSupport/Inflector/Inflections.html // Magnus Holm On Fri, Mar 22, 2013 at 2:16 PM, Francois Sery <sery.francois at gmail.com> wrote:> hello, i''m new to Camping and i dont speek english very well so , please, > forgive my mistakes...here is my question: > i want to modify the way active record Pluralize/singularize my tables > names. > > i have 2 classes: > > module Todo::models > class Tache <Base > belongs_to :categorie > end > > class Categorie< Base > has_many :taches > end > end > > "tache" and "categorie" are french words. their plural form are "taches" > and "categories ". > > when i write: > ... > maCategorie=Categorie.create(:nom => categorie) > maCategorie.taches.create(:nom => nomPropre) > ... > > I have an "unitialized constant Todo::Models::Categorie::Tach" error > message. > > i think activerecord infers that the singular for "taches" is "tach" > instead of "tache". or maybe it''s something else. > any idea ? > > thanks > > Fran?ois > > > > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list
thanks a lot ! IT works perfectly ! Fran?ois 2013/3/22 Magnus Holm <judofyr at gmail.com>> Hey Fran?ois, > > I would advice you to use English terms even though it''s not your mother > tongue. > > However, if you must, it''s pretty easy to add custom inflections: > > ActiveSupport::Inflector.inflections do |inflect| > inflect.irregular ''tach'', ''tache'' > end > > See here for more examples: > http://api.rubyonrails.org/classes/ActiveSupport/Inflector/Inflections.html > > // Magnus Holm > > > On Fri, Mar 22, 2013 at 2:16 PM, Francois Sery <sery.francois at gmail.com> > wrote: > > hello, i''m new to Camping and i dont speek english very well so , please, > > forgive my mistakes...here is my question: > > i want to modify the way active record Pluralize/singularize my tables > > names. > > > > i have 2 classes: > > > > module Todo::models > > class Tache <Base > > belongs_to :categorie > > end > > > > class Categorie< Base > > has_many :taches > > end > > end > > > > "tache" and "categorie" are french words. their plural form are "taches" > > and "categories ". > > > > when i write: > > ... > > maCategorie=Categorie.create(:nom => categorie) > > maCategorie.taches.create(:nom => nomPropre) > > ... > > > > I have an "unitialized constant Todo::Models::Categorie::Tach" error > > message. > > > > i think activerecord infers that the singular for "taches" is "tach" > > instead of "tache". or maybe it''s something else. > > any idea ? > > > > thanks > > > > Fran?ois > > > > > > > > _______________________________________________ > > Camping-list mailing list > > Camping-list at rubyforge.org > > http://rubyforge.org/mailman/listinfo/camping-list > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20130322/00b72071/attachment.html>