Re: modify the way active record Pluralize/singularize
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.franc...@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@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: modify the way active record Pluralize/singularize
thanks a lot ! IT works perfectly ! François 2013/3/22 Magnus Holm judo...@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.franc...@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@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list