[Solar-talk] Solar_Inflect class, and Models

Paul M Jones pmjones at paul-m-jones.com
Sat May 3 10:46:39 CDT 2008


Hi guys,

Antti and Andreas noticed earlier this week, but I wanted to point it  
out for those who didn't see:  I have resurrected the old  
Solar_Inflect class from last year.  This class provides methods to  
convert between singular and plural forms of English words.

The original intent behind the inflector was to automatically set  
table and column names in model classes, so that you wouldn't need to  
specify (e.g.) that "user_id" was the column name for foreign keys  
relating to a "Users" mode on a "has many users" relation.

After much discussion on its initial introduction, we all figured that  
explicit naming would be a  much better plan, especially in light of  
non-English speakers.  You can see part of that discussion here ...

   <http://mailman-mail3.webfaction.com/pipermail/solar-talk/2007-February/002328.html 
 >

... and it ended with me saying how the tyrant submits to the will of  
the people. ;-)

   <http://mailman-mail3.webfaction.com/pipermail/solar-talk/2007-February/002349.html 
 >

Now that we've had it in place for about a year, and all the  
explicitness is in place, I would like to add a layer of implicitness  
for convenience.

All the existing relationship description keys will remain, and the  
existing behavior will stay as it is.  However, if a foreign-key or  
foreign-class key is empty, I'd like to fall back to using  
Solar_Inflect to pick out the right class and key names from the  
relationship name.

I think it was the right call to leave inflection out of it while  
getting the underlying work done.  But now that the implementation is  
so well-defined, I think it would be a good thing to have inflection  
back as a convenience.  (If nothing else, I personally will find this  
helpful.)

Are there any strong objections or arguments against having implicit  
inflection in addition to (and not in place of) the existing explicit  
behavior?  The explicit behavior will take precedence, of course.


-- pmj


More information about the Solar-talk mailing list