From: Alexandre Brillant Date: 2008-08-15T23:37:12+09:00 Subject: Re: About RAILS Tx philip, I will go to the google forum. Well for the |p| after this is correct from the syntax point of view, create_table( ... ) { |p| or create_table( ... ) { |p| are both ok, I prefer the second one "Phlip" a �crit dans le message de news: ljgpk.17941$xZ.1384@nlpi070.nbdc.sbc.com... > Alexandre Brillant wrote: > >> I don't understand one point with Ruby on Rails : > > The best place to discuss RoR is here: > > http://groups.google.com/group/rubyonrails-talk/ > > This forum is only qualified to discuss Ruby, the language behind Rails, > and many other awesome programs. > >> create_table( :personnes ) { >> >> |p| > > I don't know what editor you use, but 'script/generate model' should have > created better syntax there. The |p| should be up near the {, as a style > thing. And your editor might have inserted linefeeds when you tried to > paste your source here. > > I would scratch this project and use 'script/generate model' to redo the > files. > >> And it works, but I don't understand how Rails can know that the classe >> Personne should be mapped to the >> >> personnes table. Where it is stored ? > > Google for "convention over configuration". Then pity the programmers, > using other platforms, who must edit ~1 Kb of lines of configuration > files, just to stitch things together! > > By default, ActiveRecord will read the name of your class, Personne, > lower-case it, personne, and pluralize it: personnes. Then it looks for > that table. > > It uses a class called Inflector to do this. > > However, I suspect you are lucky to use a language that pluralizes with an > s. I don't think the Inflector is smart enough to divine your language and > pluralize with its conventions - if any! Maybe someone on the RoR forum > knows how to set your locale to French, to handle French idioms > correctly... > > -- > Phlip