If I do: script/generate controller Photo I get a controller named photo_controller. OTOH, if I do: script/generate scaffold Photo I get a controller named photos_controller. (Note that the controller name is pluralized). I realize that I''m specifying the controller name explicitly in the first case, but it seems odd to me that the scaffold command generates a pluralized modelname in the absence of a specific controller name. It also seems odd that there appears to be an inconsistency here: why pluralize in one case, but not the other? Does anybody know why the controller name gets pluralized if you don''t specify it explictly when generating scaffolding? Also, from what I can tell, controller names, by convention, are not typically pluralized, so I find it curious that Rails pluralizes the controller name in this case. david
On 8/8/05, David Geary <sabreware-ihVZJaRskl1bRRN4PJnoQQ@public.gmane.org> wrote:> If I do: > > script/generate controller Photo > > I get a controller named photo_controller. OTOH, if I do: > > script/generate scaffold Photo > > I get a controller named photos_controller. (Note that the controller > name is pluralized). > > I realize that I''m specifying the controller name explicitly in the > first case, but it seems > odd to me that the scaffold command generates a pluralized modelname > in the absence > of a specific controller name. It also seems odd that there appears > to be an inconsistency > here: why pluralize in one case, but not the other?In the second case (script/generate scaffold) you''ve specified the name of the Model, and left the name of the controller for Rails to guess. It will guess the name to be the pluralization of the model name. You might want ''script/generate scaffold Photo photo'' Or just run ''script/generate scaffold'' to get the documentation.> > Does anybody know why the controller name gets pluralized if you > don''t specify it explictly > when generating scaffolding? Also, from what I can tell, controller > names, by convention, > are not typically pluralized, so I find it curious that Rails > pluralizes the controller name in this case.Convention is that Model name is singular (Photo) and Controller name is plural (photos_controller). Now many people do prefer singular controller names, but they can argue that point with DHH... Jason
Le 05-08-08 à 15:04, Jason Foreman a écrit :> On 8/8/05, David Geary <sabreware-ihVZJaRskl1bRRN4PJnoQQ@public.gmane.org> wrote: > >> If I do: >> >> script/generate controller Photo >> >> I get a controller named photo_controller. OTOH, if I do: >> >> script/generate scaffold Photo >> >> I get a controller named photos_controller. (Note that the controller >> name is pluralized). >> >> I realize that I''m specifying the controller name explicitly in the >> first case, but it seems >> odd to me that the scaffold command generates a pluralized modelname >> in the absence >> of a specific controller name. It also seems odd that there appears >> to be an inconsistency >> here: why pluralize in one case, but not the other? >> > > In the second case (script/generate scaffold) you''ve specified the > name of the Model, and left the name of the controller for Rails to > guess. It will guess the name to be the pluralization of the model > name. > You might want ''script/generate scaffold Photo photo'' > > Or just run ''script/generate scaffold'' to get the documentation.Thanks, but I knew that already. 8-)> >> Does anybody know why the controller name gets pluralized if you >> don''t specify it explictly >> when generating scaffolding? Also, from what I can tell, controller >> names, by convention, >> are not typically pluralized, so I find it curious that Rails >> pluralizes the controller name in this case. >> > > Convention is that Model name is singular (Photo) and Controller name > is plural (photos_controller).Yup, I knew that too. I''m trying to understand why it''s that way.> Now many people do prefer singular > controller names, but they can argue that point with DHH...I don''t know if that''d do any good. The pragmatic book uses singular controller names and DHH''s name is on the cover! david> > > Jason > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
On 8/8/05, David Geary <sabreware-ihVZJaRskl1bRRN4PJnoQQ@public.gmane.org> wrote:> Le 05-08-08 à 15:04, Jason Foreman a écrit : > > > On 8/8/05, David Geary <sabreware-ihVZJaRskl1bRRN4PJnoQQ@public.gmane.org> wrote: > > > >> If I do: > >> > >> script/generate controller Photo > >> > >> I get a controller named photo_controller. OTOH, if I do: > >> > >> script/generate scaffold Photo > >> > >> I get a controller named photos_controller. (Note that the controller > >> name is pluralized). > >> > >> I realize that I''m specifying the controller name explicitly in the > >> first case, but it seems > >> odd to me that the scaffold command generates a pluralized modelname > >> in the absence > >> of a specific controller name. It also seems odd that there appears > >> to be an inconsistency > >> here: why pluralize in one case, but not the other? > >> > > > > In the second case (script/generate scaffold) you''ve specified the > > name of the Model, and left the name of the controller for Rails to > > guess. It will guess the name to be the pluralization of the model > > name. > > You might want ''script/generate scaffold Photo photo'' > > > > Or just run ''script/generate scaffold'' to get the documentation. > > Thanks, but I knew that already. 8-) > > > > >> Does anybody know why the controller name gets pluralized if you > >> don''t specify it explictly > >> when generating scaffolding? Also, from what I can tell, controller > >> names, by convention, > >> are not typically pluralized, so I find it curious that Rails > >> pluralizes the controller name in this case. > >> > > > > Convention is that Model name is singular (Photo) and Controller name > > is plural (photos_controller). > > Yup, I knew that too. I''m trying to understand why it''s that way.Oh, I thought your question was more technical, as in why that command generated a pluralized controller, as opposed to a philosophical question on why Rails uses plural controller names. My apologies :)> > > Now many people do prefer singular > > controller names, but they can argue that point with DHH... > > I don''t know if that''d do any good. The pragmatic book uses singular > controller > names and DHH''s name is on the cover!Well I guess I should confess to having bought the book but not yet actually reading it... DHH, you got some ''splainin to do!! I wonder if that might be more the work of Dave Thomas than DHH though? I personally like the scheme of singular model, plural controller. The model is sort of defining the characteristics of the instances of the model. So a ''Photo'' has one ''Artist''. But the controller typically has functions to manipulate the ''Photos'', ie the controller of the Photos, or the photos_controller. Sorry I couldn''t be more help! Jason
Le 05-08-08 à 15:29, Jason Foreman a écrit :> On 8/8/05, David Geary <sabreware-ihVZJaRskl1bRRN4PJnoQQ@public.gmane.org> wrote: > >> Le 05-08-08 à 15:04, Jason Foreman a écrit : >> >> >>> On 8/8/05, David Geary <sabreware-ihVZJaRskl1bRRN4PJnoQQ@public.gmane.org> wrote: >>> >>> >>>> If I do: >>>> >>>> script/generate controller Photo >>>> >>>> I get a controller named photo_controller. OTOH, if I do: >>>> >>>> script/generate scaffold Photo >>>> >>>> I get a controller named photos_controller. (Note that the >>>> controller >>>> name is pluralized). >>>> >>>> I realize that I''m specifying the controller name explicitly in the >>>> first case, but it seems >>>> odd to me that the scaffold command generates a pluralized >>>> modelname >>>> in the absence >>>> of a specific controller name. It also seems odd that there appears >>>> to be an inconsistency >>>> here: why pluralize in one case, but not the other? >>>> >>>> >>> >>> In the second case (script/generate scaffold) you''ve specified the >>> name of the Model, and left the name of the controller for Rails to >>> guess. It will guess the name to be the pluralization of the model >>> name. >>> You might want ''script/generate scaffold Photo photo'' >>> >>> Or just run ''script/generate scaffold'' to get the documentation. >>> >> >> Thanks, but I knew that already. 8-) >> >> >>> >>> >>>> Does anybody know why the controller name gets pluralized if you >>>> don''t specify it explictly >>>> when generating scaffolding? Also, from what I can tell, controller >>>> names, by convention, >>>> are not typically pluralized, so I find it curious that Rails >>>> pluralizes the controller name in this case. >>>> >>>> >>> >>> Convention is that Model name is singular (Photo) and Controller >>> name >>> is plural (photos_controller). >>> >> >> Yup, I knew that too. I''m trying to understand why it''s that way. >> > > Oh, I thought your question was more technical, as in why that command > generated a pluralized controller, as opposed to a philosophical > question on why Rails uses plural controller names. My apologies :) > > >> >> >>> Now many people do prefer singular >>> controller names, but they can argue that point with DHH... >>> >> >> I don''t know if that''d do any good. The pragmatic book uses singular >> controller >> names and DHH''s name is on the cover! >> > > Well I guess I should confess to having bought the book but not yet > actually reading it... > > DHH, you got some ''splainin to do!! I wonder if that might be more > the work of Dave Thomas than DHH though? > I personally like the scheme of singular model, plural controller. > The model is sort of defining the characteristics of the instances of > the model. So a ''Photo'' has one ''Artist''. But the controller > typically has functions to manipulate the ''Photos'', ie the controller > of the Photos, or the photos_controller.Yes, I agree completely. However, in the book, singular names make sense; for example Admin. I don''t think you''d want a plural name in that case. Perhaps the answer is that when you use the same name for both model and controller (by not specifying a controller name explicitly) it makes sense to pluralize the controller name. If you have a specific name, you might not want it to be pluralized (like Admin, for example). And, perhaps, I''ve just answered my own question. 8-)> Sorry I couldn''t be more help!Hey, no problem. I appreciate your replies. david> > Jason > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Ed Watkeys
2005-Aug-08 22:45 UTC
Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
On Aug 8, 2005, at 5:14 PM, David Geary wrote:> Le 05-08-08 à 15:04, Jason Foreman a écrit : > >> Now many people do prefer singular >> controller names, but they can argue that point with DHH... >> > > I don''t know if that''d do any good. The pragmatic book uses > singular controller > names and DHH''s name is on the cover!It needs to be said: Auto pluralization and singularization are evil. If you disagree, please look at this patch: <http://dev.rubyonrails.com/attachment/ticket/1844/ big_inflector_fix.patch> Did you know "schemata" is the plural of "schema"? And that if you name your class "Virus", Rails will look for the table named "viri"? The two dictionaries I consulted seem to think the plural is "viruses". Stupid dictionaries! Regards, Ed -- Transmogrify, LLC * <http://xmog.com/>
Michael Koziarski
2005-Aug-08 23:13 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
> It needs to be said: Auto pluralization and singularization are evil. > If you disagree, please look at this patch:Also look at all the other patches that are there around inflector.pluralize. Various words have two plurals, equipment, index being two common examples. Money being another (sums of money pluralises to monies) Even leaving aside all the new words which the english language absorbs every year, there simply is no way to solve this problem reliably. Having said all that, it is what it is, and we can''t just break every application by turning off pluralisation by default. -- Cheers Koz
Kev Jackson
2005-Aug-09 01:23 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
> > It needs to be said: Auto pluralization and singularization are evil. > If you disagree, please look at this patch: > > <http://dev.rubyonrails.com/attachment/ticket/1844/ > big_inflector_fix.patch> > > Did you know "schemata" is the plural of "schema"? And that if you > name your class "Virus", Rails will look for the table named "viri"? > The two dictionaries I consulted seem to think the plural is > "viruses". Stupid dictionaries!Well I actually wrote that patch to address a few bugs that were on the buglist - so do you address the bugs that people post or not? I thought it''d be worthwhile fixing some/most of the requests, but it''s not up to me to actually include that code in the rails code-base. This is how open source works (at least in all the projects I''ve participated in), people contribute, and a committer decides if the contribution addresses a need or fixes an outstanding bug. As for Virus/Viri. The fact is that virus does not have a recognized plural form in it''s original language (I think Latin, but I''m not positive). Viruses is the ''anglicized'' version. Rails (at least my local version :) now uses ''viruses'' as the plural of virus. If you want to know more about algorithmic pluralization/singularization, then there are papers written on the topic and there is indeed a perl module that encapsulates the rules (we have at least 50% of these in the inflector right now, I''d actually say that in the patch we get close to 75%, catching the others is difficult as it depends on context). Schema -> Schemata, is very very odd, but then what is the plural of Octopus? It''s actually Octopodes (not Octopi - I have to shout at my old biology teacher about not knowing that one). So should we use something that is correct in terms of the roots of the language (Octopus come from greek I think), or should we go with common usage? Of course the simple answer is to do zero pluralization and then everything is fine (or broken, but all in the same way). In summary, it is a problem, but one that has an algorithmic solution, so the questions are, do we address the problem? do we use common usage as a guide, when we can make a fix to resolve someones problem do we do it?, do we aim for 100% accuracy (as the perl solution attempts), do we address the problems as the appear? (seemingly the current strategy), do we provide no pluralization (which people new to rails actually think is pretty cool in my experience) But your opinion may be different. Kev
Ben Myles
2005-Aug-09 01:35 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
Perhaps one way to make things a bit more straightforward would be to have a web-based plural lookup. So you type in "octopus" and it returns the pluralisation that Rails knows... Of course, most are obvious, but it could be helpful for some of the more complex ones and especially for newbies. Maybe even a simple Ruby script in the script directory would be better? -- Ben Myles railsapphosting.com On 8/9/05, Kev Jackson <kevin.jackson-1n8Jz8fJjQ+aMJb+Lgu22Q@public.gmane.org> wrote: ...> In summary, it is a problem, but one that has an algorithmic solution, > so the questions are, > do we address the problem? > do we use common usage as a guide, > when we can make a fix to resolve someones problem do we do it?, > do we aim for 100% accuracy (as the perl solution attempts), > do we address the problems as the appear? (seemingly the current strategy), > do we provide no pluralization (which people new to rails actually think > is pretty cool in my experience)
Chris Boone
2005-Aug-09 01:54 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
On 8/8/05, Ben Myles <ben.myles-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Perhaps one way to make things a bit more straightforward would be to > have a web-based plural lookup. So you type in "octopus" and it > returns the pluralisation that Rails knows...Geoff Grosenbach has provided us with exactly that: http://nubyonrails.topfunky.com/articles/2005/08/04/the-amazing-rails-pluralizer Assuming that''s what you meant, of course. :) -- Chris Boone http://hypsometry.com/ : website edification http://uvlist.org/ : free classifieds for the Upper Valley
Ben Myles
2005-Aug-09 02:00 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
Very cool!! That''s exactly what I meant :-) On 8/9/05, Chris Boone <hypsometry-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Geoff Grosenbach has provided us with exactly that: > > http://nubyonrails.topfunky.com/articles/2005/08/04/the-amazing-rails-pluralizer...
Kev Jackson
2005-Aug-09 02:05 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
Ben Myles wrote:>Perhaps one way to make things a bit more straightforward would be to >have a web-based plural lookup. So you type in "octopus" and it >returns the pluralisation that Rails knows... > > >There is one http://nubyonrails.topfunky.com/ uses rails/inflector to return plurals Kev
Toby Boudreaux
2005-Aug-09 02:23 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
Hallelujah. I think that in a community where "convention over configuration" is espoused as a godsend, we should really get together and establish which conventions are necessities and which are problematic, superfluous, etc. As great as the marketing and branding efforts for RoR have been thus far, the more people dig deeper or try to apply the framework to existing apps, the more backlash there is gonna be over things like pluralization. So many recorded and searchable claims on blogs and on this list in the fashion of "if it can''t be done in Rails it isn''t worth doing" are not going to help the PR effort when departments start arguing over the adoption of Ruby and Rails. Turning off pluralization in updates may or may not be acceptable at this point -- the user base is still small enough that it may be prime time to do it -- but there could be a deprecation period and an AR mix-in for future use. Though, a blanket update *could* be the best option, as long as the update is mentioned in release notes. After all - expecting problems when blindly updating software on production systems seems obvious enough to be convention to me... ;) On Aug 8, 2005, at 6:45 PM, Ed Watkeys wrote:> It needs to be said: Auto pluralization and singularization are evil._______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Michael Koziarski
2005-Aug-09 02:32 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
> Turning off pluralization in updates may or may not be acceptable at this > point -- the user base is still small enough that it may be prime time to do > it -- but there could be a deprecation period and an AR mix-in for future > use.No, I''m certain that you''ll find that *all* of the core team have rails applications which rely on pluralisation. The odds are slim if you expect commiters to break their own apps, and those of everyone else.> Though, a blanket update *could* be the best option, as long as the > update is mentioned in release notes. After all - expecting problems when > blindly updating software on production systems seems obvious enough to be > convention to me... ;) > > > > > > > > > On Aug 8, 2005, at 6:45 PM, Ed Watkeys wrote: > > > It needs to be said: Auto pluralization and singularization are evil. > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-- Cheers Koz
Rob Park
2005-Aug-09 02:33 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
On 8/8/05, Ben Myles <ben.myles-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Very cool!! That''s exactly what I meant :-)Seems slightly broken, though. Apparently you have two Octopus but I have only one Octopu. -- Urban Artography http://artography.ath.cx
Ed Watkeys
2005-Aug-09 02:40 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
On Aug 8, 2005, at 10:23 PM, Toby Boudreaux wrote:> Hallelujah. > > I think that in a community where "convention over configuration" > is espoused as a godsend, we should really get together and > establish which conventions are necessities and which are > problematic, superfluous, etc. As great as the marketing and > branding efforts for RoR have been thus far, the more people dig > deeper or try to apply the framework to existing apps, the more > backlash there is gonna be over things like pluralization. So many > recorded and searchable claims on blogs and on this list in the > fashion of "if it can''t be done in Rails it isn''t worth doing" are > not going to help the PR effort when departments start arguing over > the adoption of Ruby and Rails. > > Turning off pluralization in updates may or may not be acceptable > at this point -- the user base is still small enough that it may be > prime time to do it -- but there could be a deprecation period and > an AR mix-in for future use. Though, a blanket update *could* be > the best option, as long as the update is mentioned in release > notes. After all - expecting problems when blindly updating > software on production systems seems obvious enough to be > convention to me... ;)There are a lot of things going on in Rails. Some involve convention. Others involve inference. I am not a big fan of software making inferences about the configuration of a web application based on the vagaries of English pluralization rules. Nor am I a big fan of a system''s out-of-the-box configuration being determined by what a newbie PHP refugee knows about the art and science of database modeling. Regards, Ed -- Transmogrify, LLC * <http://xmog.com/>
Ben Myles
2005-Aug-09 02:49 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
Why can''t we have both pluralisation and non-pluralisation at the same time? Ie. Rails first looks for a table in the plural form, if it''s not found it looks for one that''s not a plural. This way it shouldn''t break existing code and it''s a really simple way to let people choose the route they want to follow. Ben
Ed Watkeys
2005-Aug-09 02:50 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
On Aug 8, 2005, at 10:32 PM, Michael Koziarski wrote:>> Turning off pluralization in updates may or may not be acceptable >> at this >> point -- the user base is still small enough that it may be prime >> time to do >> it -- but there could be a deprecation period and an AR mix-in for >> future >> use. >> > > No, I''m certain that you''ll find that *all* of the core team have > rails applications which rely on pluralisation. The odds are slim if > you expect commiters to break their own apps, and those of everyone > else.The goal is not to keep running the <1000 web apps that are currently built atop Rails, but to make Rails a compelling platform for a million more. Regards, Ed -- Transmogrify, LLC * <http://xmog.com/>
Toby Boudreaux
2005-Aug-09 02:52 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
I agree entirely. I think these rules should be determined by users during these initial "growing pains" in the relatively first days of popular adoption. I don''t know that there are any "newbie PHP refugees" trying to determine the configuration with Rails, but I''m sure configuration won''t be solely turned over to such folks anyway -- nor that they''d be making many suggestions in the first place.> Nor am I a big fan of a system''s out-of-the-box configuration being > determined by what a newbie PHP refugee knows about the art and > science of database modeling. >
Michael Koziarski
2005-Aug-09 03:16 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
> The goal is not to keep running the <1000 web apps that are currently > built atop Rails, but to make Rails a compelling platform for a > million more.My goal is to have my applications keep working, the same can be said for everyone else who uses rails. If you want another million applications to be built with rails, we can''t just go breaking the installed base when we find something we don''t like. That is *much* more annoying (ask anyone who moved from rails 0.8->0.13, things changed all over the place). Just like we continue to support the old style finders, rails will continue to support pluralised table names, and apps which use them. They key is to find a way to support pluralisation as ''off'' for new applications, but not break existing applications when they try to upgrade. This is certainly possible. -- Cheers Koz
Tyler Kiley
2005-Aug-09 03:19 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
AFAIK, the original reason for auto pluralization was twofold: 1. Plural table names and singular database names make rails apps easier and more natural to discuss conversationally -- it fits with the way we think about them. 2. It''s way cooler to automatically determine the plural form of a word than to specify it in every file (convention over configuration) The reasoning behind auto pluralization is still valid, and it does provide the benefit it claims to provide (whether you care about that benefit is a different issue entirely). Why not just leave things the way they are right now, and just make sure newbies know how to manually specify the table name of a model, for those cases where the inflector falls short?
Michael Koziarski
2005-Aug-09 03:21 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
On 8/9/05, Ben Myles <ben.myles-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Why can''t we have both pluralisation and non-pluralisation at the same > time? Ie. Rails first looks for a table in the plural form, if it''s > not found it looks for one that''s not a plural. This way it shouldn''t > break existing code and it''s a really simple way to let people choose > the route they want to follow.This is backwards compatible, so it''s more likely to get accepted. Care to implement a patch? -- Cheers Koz
Andrew Stuart
2005-Aug-09 03:50 UTC
Re: Let''s call a spade a spade. [was Re: PluralizedController Names?]
consider apple''s one button mouse.
Isaac Reuben
2005-Aug-09 03:51 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
On 8/8/05, Michael Koziarski <koziarski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 8/9/05, Ben Myles <ben.myles-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Why can''t we have both pluralisation and non-pluralisation at the same > > time? Ie. Rails first looks for a table in the plural form, if it''s > > not found it looks for one that''s not a plural. This way it shouldn''t > > break existing code and it''s a really simple way to let people choose > > the route they want to follow. > > This is backwards compatible, so it''s more likely to get accepted. > Care to implement a patch?I think this is great idea. Might even be nice to check for the plural or singular version of missing models and controllers as well as tables. This would be a great help towards making people''s first experiences with Rails more positive. I know I had quite a bit of head-scratching at first about why my code wasn''t working, when it was looking for some things as singular as some as plural. - Isaac
Ben Myles
2005-Aug-09 03:56 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
Well if none of the core developers have any gripes I''ll have a look at implementing a patch. I can''t promise anything though as I haven''t studied the intimate internals of Rails yet. It should be a good learning experience. -- Ben Myles railsapphosting.com On 8/9/05, Isaac Reuben <ireuben-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I think this is great idea. Might even be nice to check for the > plural or singular version of missing models and controllers as well > as tables. This would be a great help towards making people''s first > experiences with Rails more positive. I know I had quite a bit of > head-scratching at first about why my code wasn''t working, when it was > looking for some things as singular as some as plural.
Tristan Havelick
2005-Aug-09 04:12 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
Why not standardize on a single source for pluralization rules, such as Merriam-Webster, (m-w.com) and then make it easy for people to override (which it probably already is) the built in functionality for personal preference and/or backwards compatability? On 8/8/05, Isaac Reuben <ireuben-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 8/8/05, Michael Koziarski <koziarski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > On 8/9/05, Ben Myles <ben.myles-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Why can''t we have both pluralisation and non-pluralisation at the same > > > time? Ie. Rails first looks for a table in the plural form, if it''s > > > not found it looks for one that''s not a plural. This way it shouldn''t > > > break existing code and it''s a really simple way to let people choose > > > the route they want to follow. > > > > This is backwards compatible, so it''s more likely to get accepted. > > Care to implement a patch? > > I think this is great idea. Might even be nice to check for the > plural or singular version of missing models and controllers as well > as tables. This would be a great help towards making people''s first > experiences with Rails more positive. I know I had quite a bit of > head-scratching at first about why my code wasn''t working, when it was > looking for some things as singular as some as plural. > > - Isaac > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Deirdre Saoirse Moen
2005-Aug-09 07:13 UTC
Octopuses was Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
On Aug 8, 2005, at 6:23 PM, Kev Jackson wrote:> Schema -> Schemata, is very very odd, but then what is the plural > of Octopus? It''s actually Octopodes (not Octopi - I have to shout > at my old biology teacher about not knowing that one).Actually, Octopodes is not the common -- or preferred -- form of the plural. The OED (normally very conservative in usage) lists Octopuses, Octopi, and Octopodes, in that order. Octopuses is generally the preferred plural. Fowler (the pedant''s choice for usage) agrees. http://en.wikipedia.org/wiki/Octopus Go, pods, go!
Kev Jackson
2005-Aug-09 07:41 UTC
Re: Octopuses was Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
> > Actually, Octopodes is not the common -- or preferred -- form of the > plural. The OED (normally very conservative in usage) lists > Octopuses, Octopi, and Octopodes, in that order. >The point I was trying to make was do we try to use common usage as a guide, or the real genuine historical plural - Octopodes is not common, but it is the correct one - all the others are newer/incorrect (for a given value of correct) - see http://www.csse.monash.edu.au/~damian/papers/HTML/Plurals.html for more info Actually at the moment octopus is probably pluralised as octopi or octopuses in rails> Octopuses is generally the preferred plural. Fowler (the pedant''s > choice for usage) agrees.Who is fowler? I immediately thought of Martin Fowler, but I doubt he cares a jot about linguistic nuances Kev
Ed Watkeys
2005-Aug-09 11:11 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
On Aug 8, 2005, at 11:16 PM, Michael Koziarski wrote:>> The goal is not to keep running the <1000 web apps that are currently >> built atop Rails, but to make Rails a compelling platform for a >> million more. >> > > My goal is to have my applications keep working, the same can be said > for everyone else who uses rails.While in this case, breaking people''s code to make such a change is unnecessary and unadvised, I disagree with your assertion, or at least your assertion''s implication, that everyone''s goal is to have Rails never break their code. A web app is a means to an end, and if breaking some code makes Rails more suited to achieving a people''s ultimate goals -- making money, curing cancer, distributing warez -- they SHOULD be happy to upgrade and make whatever changes are necessary. It''s not as if anyone is forcing them to upgrade immediately. Deciding whether to break code is complex. Keeping a deprecated interface around makes life easier for developers but delays the inevitable and makes the system more complex. Complex means bigger and slower. There''s a tradeoff. This early in the life of Rails, I would hope the Rails core developers have an aggressive approach to purging deprecated code from the system. A project can get popular too quickly. Popularity means an installed base means people how don''t want their code to break. You need just the right adoption curve. The hype surrounding Rails perhaps attracted too many mainstream users when Rails really needs thrill- seeking, risk-tolerant early adopters. Regards, Ed -- Transmogrify, LLC * <http://xmog.com/>
Michael Teter
2005-Aug-09 15:40 UTC
Re: Octopuses was Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
I may be asking for it, but why even bother with auto-pluralization? It seems like an unnecessary gimmick, in contrast to the Rails philosophy of keeping things simple. And not only does it add complexity that''s (imo) not necessary, it adds confusion in some cases. I''m just guessing, but I imagine ESL speaking people might have even more problems early on getting used to it. Why is the system necessary? Why do table names need to be plural? For example, before Rails I would call my table "person", because it defines a person. Yes it hold a collection of persons, but the table definition describes a person. I''ve always been comfortable saying "select * from person where lastname like ''Thom%''. To me it''s the "person table".
Rob Park
2005-Aug-09 15:49 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
On 8/8/05, Ben Myles <ben.myles-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Why can''t we have both pluralisation and non-pluralisation at the same > time? Ie. Rails first looks for a table in the plural form, if it''s > not found it looks for one that''s not a plural. This way it shouldn''t > break existing code and it''s a really simple way to let people choose > the route they want to follow.This is going about it backwards. The point of getting rid of pluralisation is so that we don''t have to waste processing power computing the plural of the word. So the code should by default check for the *singular* table name, and if it''s not found, *then* fall back to the pluralised table name. -- Urban Artography http://artography.ath.cx
Rick Olson
2005-Aug-09 15:55 UTC
Re: Octopuses was Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
> Why is the system necessary? Why do table names need to be plural? > > For example, before Rails I would call my table "person", because it > defines a person. Yes it hold a collection of persons, but the table > definition describes a person. I''ve always been comfortable saying > "select * from person where lastname like ''Thom%''. To me it''s the > "person table".I think it''s because it''s what David prefers, and it works with most cases. But, it''s not necessary by any means. Just add this to your environment.rb: ActiveRecord::Base.pluralize_table_names = false If you have a beef with the id primary keys and would prefer person_id, use this: ActiveRecord::Base.primary_key_prefix_type = :table_name_with_underscore Plural tables make more sense to me personally. Each row in a people table is a Person. It doesn''t always fit, so I take a deep breath, write set_table_name ''person'', and move on. We''re approaching v1.0 and there are many developers and thousands of deployed apps. It''s not really the time to make this kind of breaking change because we''re running into edge cases with octopodes and viri. Well, on the flipside, maybe now is as good a time as there ever will be. We all managed the move to routes and the addition of the DoubleRenderError. -- rick http://techno-weenie.net
Ben Myles
2005-Aug-09 15:58 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
Good point, I agree. However, I''m not really convinced there''s anything broken anyway. How hard is it to insert the line: ActiveRecord::Base.pluralize_table_names= false into your environment.rb file? On 8/10/05, Rob Park <rbpark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> This is going about it backwards. The point of getting rid of > pluralisation is so that we don''t have to waste processing power > computing the plural of the word. So the code should by default check > for the *singular* table name, and if it''s not found, *then* fall back > to the pluralised table name.
Michael Teter
2005-Aug-09 16:12 UTC
Re: Octopuses was Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
Thanks for the tips! I''m not going to be too greedy about how Rails works because I''m just glad to have it, but when the topic comes up I started remembering my pain :) On 8/9/05, Rick Olson <technoweenie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Why is the system necessary? Why do table names need to be plural? > > > > For example, before Rails I would call my table "person", because it > > defines a person. Yes it hold a collection of persons, but the table > > definition describes a person. I''ve always been comfortable saying > > "select * from person where lastname like ''Thom%''. To me it''s the > > "person table". > > I think it''s because it''s what David prefers, and it works with most > cases. But, it''s not necessary by any means. Just add this to your > environment.rb: > > ActiveRecord::Base.pluralize_table_names = false > > If you have a beef with the id primary keys and would prefer > person_id, use this: > > ActiveRecord::Base.primary_key_prefix_type = :table_name_with_underscore > > Plural tables make more sense to me personally. Each row in a people > table is a Person. It doesn''t always fit, so I take a deep breath, > write set_table_name ''person'', and move on. > > We''re approaching v1.0 and there are many developers and thousands of > deployed apps. It''s not really the time to make this kind of breaking > change because we''re running into edge cases with octopodes and viri. > Well, on the flipside, maybe now is as good a time as there ever will > be. We all managed the move to routes and the addition of the > DoubleRenderError. > > -- > rick > http://techno-weenie.net > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Steve Downey
2005-Aug-09 16:18 UTC
Re: Octopuses was Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
Michael Teter wrote:>I may be asking for it, but why even bother with auto-pluralization? >It seems like an unnecessary gimmick, in contrast to the Rails >philosophy of keeping things simple. And not only does it add >complexity that''s (imo) not necessary, it adds confusion in some >cases. I''m just guessing, but I imagine ESL speaking people might >have even more problems early on getting used to it. > >Why is the system necessary? Why do table names need to be plural? > >For example, before Rails I would call my table "person", because it >defines a person. Yes it hold a collection of persons, but the table >definition describes a person. I''ve always been comfortable saying >"select * from person where lastname like ''Thom%''. To me it''s the >"person table". >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails > > >Agreed. I know almost nothing about internationalization but a little bit about foreign languages. What does the pluralization do with non-English words? Adding ''s'', ''es'', etc. can''t be a very universally applicable rule. Or do we expect everyone to Anglicize their table names?
Steve Downey
2005-Aug-09 16:22 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
Ben Myles wrote:>Good point, I agree. > >However, I''m not really convinced there''s anything broken anyway. How >hard is it to insert the line: > >ActiveRecord::Base.pluralize_table_names= false > >into your environment.rb file? > > >Not hard for most people on this list. But non-trivial for someone giving Rails the once-over. I for one want Rub/Rails to get as wide an acceptance as possible. Anything that trips up the first-timer/evaluator isn''t good, IMO. How many reviews/blog entries have we read that have several, "yes but.." statements about some of the less conventional conventions.
Jason Foreman
2005-Aug-09 16:23 UTC
Re: Octopuses was Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
On 8/9/05, Rick Olson <technoweenie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Why is the system necessary? Why do table names need to be plural? > > > > For example, before Rails I would call my table "person", because it > > defines a person. Yes it hold a collection of persons, but the table > > definition describes a person. I''ve always been comfortable saying > > "select * from person where lastname like ''Thom%''. To me it''s the > > "person table". > > I think it''s because it''s what David prefers, and it works with most > cases. But, it''s not necessary by any means. Just add this to your > environment.rb: > > ActiveRecord::Base.pluralize_table_names = false > > If you have a beef with the id primary keys and would prefer > person_id, use this: > > ActiveRecord::Base.primary_key_prefix_type = :table_name_with_underscore >+1 If you don''t like it, don''t use it.> Plural tables make more sense to me personally. Each row in a people > table is a Person. It doesn''t always fit, so I take a deep breath, > write set_table_name ''person'', and move on.+1 This has worked well for people so far. If you have an edge case, just take the 2 seconds and type in the name explicitly....> We''re approaching v1.0 and there are many developers and thousands of > deployed apps. It''s not really the time to make this kind of breaking > change because we''re running into edge cases with octopodes and viri. > Well, on the flipside, maybe now is as good a time as there ever will > be. We all managed the move to routes and the addition of the > DoubleRenderError.I certainly think the time to make any sort of big changes like this is PRE 1.0 release. One would hope that people with deployed production rails apps will not go willy nilly upgrading rails versions anyway - either by specifying a specific gem version or by having a copy in the lib/vendor dir. This ensures that once it works, it will always work. Anyone who writes web apps in Java will know this. Any library you use will likely be copied into your application, rather than relying on shared copies present in the app server. Take a look at how many copies of log4j exist on one java server and you''ll understand :) If the biggest problems Rails has now are little annoyances like pluralization, things are looking pretty good. Jason
Jason Foreman
2005-Aug-09 16:29 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
On 8/9/05, Rob Park <rbpark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> [...] The point of getting rid of > pluralisation is so that we don''t have to waste processing power > computing the plural of the word. [...]Are you serious? Can you provide any data, benchmark, whatever, to show that the pluralization of names has a negative impact on the performance of your application? This doesn''t seem to be a very strong argument for changing the current behavior. But I''ll gladly rescind my comment if proven wrong. Jason
Joe Van Dyk
2005-Aug-09 17:11 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
On 8/8/05, Kev Jackson <kevin.jackson-1n8Jz8fJjQ+aMJb+Lgu22Q@public.gmane.org> wrote:> > > > > It needs to be said: Auto pluralization and singularization are evil. > > If you disagree, please look at this patch: > > > > <http://dev.rubyonrails.com/attachment/ticket/1844/ > > big_inflector_fix.patch> > > > > Did you know "schemata" is the plural of "schema"? And that if you > > name your class "Virus", Rails will look for the table named "viri"? > > The two dictionaries I consulted seem to think the plural is > > "viruses". Stupid dictionaries! > > Well I actually wrote that patch to address a few bugs that were on the > buglist - so do you address the bugs that people post or not? I thought > it''d be worthwhile fixing some/most of the requests, but it''s not up to > me to actually include that code in the rails code-base. This is how > open source works (at least in all the projects I''ve participated in), > people contribute, and a committer decides if the contribution addresses > a need or fixes an outstanding bug. > > As for Virus/Viri. The fact is that virus does not have a recognized > plural form in it''s original language (I think Latin, but I''m not > positive). Viruses is the ''anglicized'' version. Rails (at least my > local version :) now uses ''viruses'' as the plural of virus. If you want > to know more about algorithmic pluralization/singularization, then there > are papers written on the topic and there is indeed a perl module that > encapsulates the rules (we have at least 50% of these in the inflector > right now, I''d actually say that in the patch we get close to 75%, > catching the others is difficult as it depends on context). Schema -> > Schemata, is very very odd, but then what is the plural of Octopus? > It''s actually Octopodes (not Octopi - I have to shout at my old biology > teacher about not knowing that one). So should we use something that is > correct in terms of the roots of the language (Octopus come from greek I > think), or should we go with common usage? Of course the simple answer > is to do zero pluralization and then everything is fine (or broken, but > all in the same way).So, dictionary.com is wrong with their pluralization of Octopus? http://www.answers.com/octopus
Rick Olson
2005-Aug-09 17:14 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
> So, dictionary.com is wrong with their pluralization of Octopus? > http://www.answers.com/octopus >Is someone writing a marine biology app? -- rick http://techno-weenie.net
Matt Jankowski
2005-Aug-09 17:22 UTC
Re: Let''s call a spade a spade and the table it''s in the ''spades'' table....maybe.
> So, dictionary.com is wrong with their pluralization of Octopus? > http://www.answers.com/octopusPeople (or persons)... You can turn off pluralization if you don''t like it. If you have a more intelligent way that rails can behave by default, submit a patch or write a ticket describing the change. I would appreciate VERY MUCH if the person who is building an application that requires an octopuses table could email me off list and let me know more about what it is that they''re doing and why. -Matt
Michael Teter
2005-Aug-09 17:31 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
Logically, computing plurals of words absolutely must take more time than not doing it :) Of course it''s probably not _much_ extra time... But anyway, perhaps he was speaking of human computation - making sure you understand how your words are going to be pluralized. The fact that (I now know) there is an easy way to disable the pluralization may make the whole discussion moot, at least for those of us who would choose not to use it. On 8/9/05, Jason Foreman <threeve.org-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 8/9/05, Rob Park <rbpark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > [...] The point of getting rid of > > pluralisation is so that we don''t have to waste processing power > > computing the plural of the word. [...] > > Are you serious? > > Can you provide any data, benchmark, whatever, to show that the > pluralization of names has a negative impact on the performance of > your application? This doesn''t seem to be a very strong argument for > changing the current behavior. But I''ll gladly rescind my comment if > proven wrong. > > > Jason > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Sean T Allen
2005-Aug-09 17:33 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
Rick Olson wrote:>>So, dictionary.com is wrong with their pluralization of Octopus? >>http://www.answers.com/octopus >> >> >> > >Is someone writing a marine biology app? > > >funny we had this exact discussion two weeks ago... or was it three... _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Tobias Luetke
2005-Aug-09 17:37 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
> > The goal is not to keep running the <1000 web apps that are currently > built atop Rails, but to make Rails a compelling platform for a > million more. >Pluralisation helps greatly with this. Come out of your microcosm. All rails needs is a simple way to add special rules or exceptions to the inflector tables form perhaps the environment.rb. -- Tobi http://www.snowdevil.ca - Snowboards that don''t suck http://typo.leetsoft.com - Open source weblog engine http://blog.leetsoft.com - Technical weblog
Jay Levitt
2005-Aug-09 20:21 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
In article <ea7102f90508082019155763af-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>, tyler.kiley- Re5JQEeQqe8AvxtiuMwx3w-XMD5yJDbdMReXY1tMh2IBg@public.gmane.org says...> The reasoning behind auto pluralization is still valid, and it does > provide the benefit it claims to provide (whether you care about that > benefit is a different issue entirely). Why not just leave things the > way they are right now, and just make sure newbies know how to > manually specify the table name of a model, for those cases where the > inflector falls short?+1 -- Jay Levitt | Wellesley, MA | I feel calm. I feel ready. I can only Faster: jay at jay dot fm | conclude that''s because I don''t have a http://www.jay.fm | full grasp of the situation. - Mark Adler
Michael Koziarski
2005-Aug-09 20:46 UTC
Re: Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
> > The reasoning behind auto pluralization is still valid, and it does > > provide the benefit it claims to provide (whether you care about that > > benefit is a different issue entirely). Why not just leave things the > > way they are right now, and just make sure newbies know how to > > manually specify the table name of a model, for those cases where the > > inflector falls short? > > +1+20 -- Cheers Koz
Aaron Ransley
2005-Aug-09 20:58 UTC
Re: Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
+20 as well :-) On 8/9/05, Michael Koziarski <koziarski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > The reasoning behind auto pluralization is still valid, and it does > > > provide the benefit it claims to provide (whether you care about that > > > benefit is a different issue entirely). Why not just leave things the > > > way they are right now, and just make sure newbies know how to > > > manually specify the table name of a model, for those cases where the > > > inflector falls short? > > > > +1 > +20 > > -- > Cheers > > Koz > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- - Aaron ''Jomdom'' Ransley - Web: www.jomdom.net - Mail: jomdom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Carl Youngblood
2005-Aug-09 21:08 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
Merriam Webster says the plural of Octopus is "octopuses or octopi" www.m-w.com Carl On 8/8/05, Kev Jackson <kevin.jackson-1n8Jz8fJjQ+aMJb+Lgu22Q@public.gmane.org> wrote: context). Schema ->> Schemata, is very very odd, but then what is the plural of Octopus? > It''s actually Octopodes (not Octopi - I have to shout at my old biology > teacher about not knowing that one). So should we
Carl Youngblood
2005-Aug-09 21:11 UTC
Re: Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
I agree. On 8/9/05, Aaron Ransley <jomdom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> +20 as well :-) > > On 8/9/05, Michael Koziarski <koziarski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > The reasoning behind auto pluralization is still valid, and it does > > > > provide the benefit it claims to provide (whether you care about that > > > > benefit is a different issue entirely). Why not just leave things the > > > > way they are right now, and just make sure newbies know how to
Ed Watkeys
2005-Aug-09 22:23 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
On Aug 9, 2005, at 1:37 PM, Tobias Luetke wrote:>> >> The goal is not to keep running the <1000 web apps that are currently >> built atop Rails, but to make Rails a compelling platform for a >> million more. >> >> > > Pluralisation helps greatly with this. Come out of your microcosm.You''re encouraging people to learn the wrong way to name tables. We have a duty to NOT perpetuate ignorance and incompetence. Regards, Ed -- Transmogrify, LLC * <http://xmog.com/>
Michael Koziarski
2005-Aug-09 23:11 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
> > Pluralisation helps greatly with this. Come out of your microcosm. > > You''re encouraging people to learn the wrong way to name tables. We > have a duty to NOT perpetuate ignorance and incompetence.Please get some perspective. There''s no right or wrong way to name tables, just different models with different options with pros and cons. Choosing to name tables differently doesn''t make someone ignorant or incompetent. -- Cheers Koz
Caleb Buxton
2005-Aug-09 23:32 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
On 8/9/05, Rick Olson <technoweenie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > So, dictionary.com is wrong with their pluralization of Octopus? > > http://www.answers.com/octopus > > > > Is someone writing a marine biology app?+1 zinger
Michael Schoen
2005-Aug-09 23:34 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
>> Pluralisation helps greatly with this. Come out of your microcosm. > > You''re encouraging people to learn the wrong way to name tables. We > have a duty to NOT perpetuate ignorance and incompetence.Let''s play nice here. There''s no "wrong" way. Lots of people were raised to make them singular (myself included), lots of people to make them plural. There continues to be active debate on which is more "natural", and incompetence plays no larger role than it does in the vi vs. emacs wars. It''s also incredibly easy to make it work the way you want, just by setting: ActiveRecord::Base.pluralize_table_names = false Given that using plural table names is a common convention (even if it''s not the one I happen to use), I consider auto-pluralization to be a CRITICAL feature of Rails -- even though the first thing I do is turn it off! Rails is all about convention over configuration, and it''s a feature that makes it work for lots of folks. My convention just doesn''t happen to require any special feature, other than to turn this one off. Now you COULD argue that singular table names is more common, and that we should change the default. That would break existing apps, though the "fix" would be as simple as: ActiveRecord::Base.pluralize_table_names = true But when it comes down to it, does it really matter? Probably the most important thing is that the key assumptions on conventions (table names, primary key names, etc) are clearly identified along with the associated knobs, so that new folks can make it work for them very easily. Perhaps the generated environment.rb file should include a few of these knobs with some useful comments.
Tobias Luetke
2005-Aug-10 00:20 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
> You''re encouraging people to learn the wrong way to name tables. We > have a duty to NOT perpetuate ignorance and incompetence.Please use struts. -- Tobi http://www.snowdevil.ca - Snowboards that don''t suck http://typo.leetsoft.com - Open source weblog engine http://blog.leetsoft.com - Technical weblog
Grant Johnson
2005-Aug-10 00:55 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
> Let''s play nice here. There''s no "wrong" way. Lots of people were > raised to make them singular (myself included), lots of people to make > them plural. > > There continues to be active debate on which is more "natural", and > incompetence plays no larger role than it does in the vi vs. emacs wars. > > It''s also incredibly easy to make it work the way you want, just by > setting: > > ActiveRecord::Base.pluralize_table_names = false > > Given that using plural table names is a common convention (even if > it''s not the one I happen to use), I consider auto-pluralization to be > a CRITICAL feature of Rails -- even though the first thing I do is > turn it off! Rails is all about convention over configuration, and > it''s a feature that makes it work for lots of folks. My convention > just doesn''t happen to require any special feature, other than to turn > this one off. > > Now you COULD argue that singular table names is more common, and that > we should change the default. That would break existing apps, though > the "fix" would be as simple as: > > ActiveRecord::Base.pluralize_table_names = true > > But when it comes down to it, does it really matter? Probably the most > important thing is that the key assumptions on conventions (table > names, primary key names, etc) are clearly identified along with the > associated knobs, so that new folks can make it work for them very > easily. > > Perhaps the generated environment.rb file should include a few of > these knobs with some useful comments. > >The way SOME tools do this is that they have the config file (environment.rb) pre-populated with the defaults, to make it easy to know how to switch them without having to look up the names. This may be the best solution. Even when you turn that off, it still does funny things with model and controller names. Is there a way to switch off all pluralization? I had a test table called "bogus" it make lots of "bogu" stuff! Any way, this is funny, and I would prefer to have it just take what I type, but at the same time I understand no breaking existing apps. Just pre-populate environment.rb with 20 or 30 of the interesting or popular items so they are easy to change, and everyone is happy, even the octopuseseseseses.
Kev Jackson
2005-Aug-10 01:11 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
Caleb Buxton wrote:>On 8/9/05, Rick Olson <technoweenie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > >>>So, dictionary.com is wrong with their pluralization of Octopus? >>>http://www.answers.com/octopus >>> >>> >>> >>Is someone writing a marine biology app? >> >>nope, http://search.cpan.org/src/DCONWAY/Lingua-EN-Inflect-1.89/lib/Lingua/EN/Inflect.pm see: >> I''m not taking any further correspondence on: =over =item "octopi". Despite the populist pandering of certain New World dictionaries, the plural is "octopuses" or (for the pendantic classicist) "octopodes". The suffix "-pus" is Greek, not Latin, so the plural is "-podes", not "pi". =item "virus". Had no plural in Latin (possibly because it was a mass noun). The only plural is the Anglicized "viruses". << If I''d have known that people would have taken exception to an attempt to fix reported bugs I wouldn''t have bothered. Talk about biting the hand that feeds. And as it''s a one-liner to turn this feature off I think this whole thread has been a waste of bits, especially as we now have people claiming that using plural table names is ignorant, as opposed to simply a different style. I''ll think very carefully before contributing a patch to Rails again if this is the sort of vehement opposition it brings out of the woodwork - and as far as I''m aware the damn patch hasn''t even been committed, so it''s irrelevant. Kev
Ed Watkeys
2005-Aug-10 02:36 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
On Aug 9, 2005, at 7:11 PM, Michael Koziarski wrote:>>> Pluralisation helps greatly with this. Come out of your microcosm. >>> >> You''re encouraging people to learn the wrong way to name tables. We >> have a duty to NOT perpetuate ignorance and incompetence. >> > > Please get some perspective. > > There''s no right or wrong way to name tables, just different models > with different options with pros and cons. Choosing to name tables > differently doesn''t make someone ignorant or incompetent.There may not be one right way, but there are most definitely wrong ways. This isn''t high school English class where the teacher is obligated to find something positive to say about everyone''s interpretation of Antigone. On Aug 9, 2005, at 7:34 PM, Michael Schoen wrote:>>> Pluralisation helps greatly with this. Come out of your microcosm. >>> >> You''re encouraging people to learn the wrong way to name tables. >> We have a duty to NOT perpetuate ignorance and incompetence. >> > > Let''s play nice here. There''s no "wrong" way. Lots of people were > raised to make them singular (myself included), lots of people to > make them plural.You were raised by people who taught you well.> There continues to be active debate on which is more "natural", and > incompetence plays no larger role than it does in the vi vs. emacs > wars.This isn''t a question of what feels natural: It''s a question of not indulging their bad habits or misconceptions. On Aug 9, 2005, at 8:20 PM, Tobias Luetke wrote:>>> Pluralisation helps greatly with this. Come out of your microcosm. >>> >> You''re encouraging people to learn the wrong way to name tables. We >> have a duty to NOT perpetuate ignorance and incompetence. >> > > Please use struts.I''ve been insulted more coherently by more knowledgeable people than you. Struts knows nothing about how a model object is stored in a database -- if it''s stored in a database at all. I''ve never written a Struts application. I''m generally program in Scheme, Python, Perl, Objective-C, and Ruby: five dynamic languages. When I learn how to do something, I try to figure out how smart, experienced people do it. I''ve never met a smart, experienced database developer who would name a table "posts" even if someone put a gun to his or her head. This is a pointless battle -- and why do I care? Go ahead and name your tables "people", "viri", and "octopodes". I''ll just continue adding my magic configuration lines in every app I build. Regards, Ed -- Transmogrify, LLC * <http://xmog.com/>
Michael Koziarski
2005-Aug-10 03:55 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
> This is a pointless battle -- and why do I care? Go ahead and name > your tables "people", "viri", and "octopodes". I''ll just continue > adding my magic configuration lines in every app I build.Yes why do you care? Stop flaming. Can we please just put this thread to death. -- Cheers Koz
Rob Park
2005-Aug-14 21:18 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
On 8/9/05, Michael Teter <michael.teter-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Logically, computing plurals of words absolutely must take more time > than not doing it :) Of course it''s probably not _much_ extra time...Took the words right out of my mouth, thank you. My only complaint with auto pluralising words is that it gets a lot of words wrong (in fact there are many words which we can never agree on the correct pluralisation, so any automatic pluralisation routine can never been 100% correct because nobody really knows what 100% correct is). As far as I can see, the only "benefit" of having auto pluralisation is so that some rails code reads more like english than code, which is a dubious benefit at best. Code is code, it should be precise, not like English which is vague and imprecise. Of course, having pluralisation turned off by default in future releases will only break all the existing applications, which is a cure worse than the disease, so for now I''ll just have to consider auto-pluralisation to be a crufty feature necessary for compatibility that should be deprecated sooner or later and phased out. -- Urban Artography http://artography.ath.cx
Michael Campbell
2005-Aug-14 21:44 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
Rob Park <rbpark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:> Of course, having pluralisation turned off by default in future > releases will only break all the existing applications, which is a > cure worse than the disease,...I disagree. There''s no better time than RIGHT NOW than to fix this arbitrary and easily most confusing aspect of rails. There are never going to be /fewer/ rails apps out than there are now, and with the PragBook just having hit the streets, I suspect a big spike in numbers coming soon. -- I tend to view "truly flexible" by another term: "Make everything equally hard". -- DHH
Tyler Kiley
2005-Aug-15 00:12 UTC
Re: Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
On 14 Aug 2005 17:44:53 -0400, Michael Campbell <michael.campbell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I disagree. There''s no better time than RIGHT NOW than to fix this > arbitrary and easily most confusing aspect of rails. There are never > going to be /fewer/ rails apps out than there are now, and with the > PragBook just having hit the streets, I suspect a big spike in numbers > coming soon.The original reasoning behind this feature (more conversational discussion of app development) is still valid. If you''ve read the pragbook, you know that it devotes ample time to explaning how to disable the feature, and how to work around it when it pluralizes incorrectly. If you don''t like it, you can disable it; what''s your beef with that? Think about your reasoning for wanting to make the change now -- the prag book just started shipping, so thousands of rails devs are getting dead-tree documentation for a feature that you want to change after the ink has barely had time to dry. Does that really make sense? If there was ever a time to "fix" this "problem", it was three or four months ago; now, the best option is to just get in the habit of disabling it in your apps if it''s that much of an inconvenience to you. (Disclaimer: I happen to like auto pluralization.) Tyler
Toby Boudreaux
2005-Aug-15 00:56 UTC
Re: Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
I haven''t looked at the code base with this in mind, but I''m curious - how much code is loaded and parsed even if pluralization is disabled? How much memory is used? Has anyone benchmarked application start up and per-request stats for pluralization being enabled, disabled, and removed? On Aug 14, 2005, at 8:12 PM, Tyler Kiley wrote:> On 14 Aug 2005 17:44:53 -0400, Michael Campbell > <michael.campbell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> I disagree. There''s no better time than RIGHT NOW than to fix this >> arbitrary and easily most confusing aspect of rails. There are never >> going to be /fewer/ rails apps out than there are now, and with the >> PragBook just having hit the streets, I suspect a big spike in >> numbers >> coming soon. >> > > The original reasoning behind this feature (more conversational > discussion of app development) is still valid. If you''ve read the > pragbook, you know that it devotes ample time to explaning how to > disable the feature, and how to work around it when it pluralizes > incorrectly. If you don''t like it, you can disable it; what''s your > beef with that? > > Think about your reasoning for wanting to make the change now -- the > prag book just started shipping, so thousands of rails devs are > getting dead-tree documentation for a feature that you want to change > after the ink has barely had time to dry. Does that really make > sense? > > If there was ever a time to "fix" this "problem", it was three or four > months ago; now, the best option is to just get in the habit of > disabling it in your apps if it''s that much of an inconvenience to > you. > > (Disclaimer: I happen to like auto pluralization.) > > Tyler > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
M. Edward (Ed) Borasky
2005-Aug-15 01:32 UTC
Re: Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
Let me weigh in here. I just ordered the "dead-tree" document, as someone just put it. I''ve been a programmer for 43 years. In that 43 years I''ve seen languages come and go, computer architectures come and go, operating systems come and go, and applications come and go. I''ve decided to learn Ruby, Ruby on Rails and web application development simultaneously/concurrently. /*Let me emphasize this -- I want this heard loud and clear -- a development environment exists for the sole purpose of making the developer''s job of satisfying the end users as easy as possible. */A development environment where someone can make an arbitrary change in the syntax or semantics without good reason makes that hard. I wrote some Perl 4 code a few years ago, which ran perfectly well until someone changed Perl to use character semantics rather than byte semantics by default. And I won''t trouble you with the troubles gcc 4.0 hath wrought; I''m still at 3.3.5 for a very good reason. Ruby is a young language -- 1.8 vs. Perl 5.8. And Ruby on Rails is a young framework. Ruby and Ruby on Rails owe it to the developers and their customers to maintain a core environment that will work /***forever***/, and clearly document stuff that isn''t part of that core. Then it''s *my* responsibility as a developer to use only what I know is going to be there for me. Tyler Kiley wrote:>The original reasoning behind this feature (more conversational >discussion of app development) is still valid. If you''ve read the >pragbook, you know that it devotes ample time to explaning how to >disable the feature, and how to work around it when it pluralizes >incorrectly. If you don''t like it, you can disable it; what''s your >beef with that? > >Think about your reasoning for wanting to make the change now -- the >prag book just started shipping, so thousands of rails devs are >getting dead-tree documentation for a feature that you want to change >after the ink has barely had time to dry. Does that really make >sense? > >If there was ever a time to "fix" this "problem", it was three or four >months ago; now, the best option is to just get in the habit of >disabling it in your apps if it''s that much of an inconvenience to >you. >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Ed Watkeys
2005-Aug-15 01:42 UTC
Re: Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
On Aug 14, 2005, at 8:12 PM, Tyler Kiley wrote:> On 14 Aug 2005 17:44:53 -0400, Michael Campbell > <michael.campbell-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> I disagree. There''s no better time than RIGHT NOW than to fix this >> arbitrary and easily most confusing aspect of rails. There are never >> going to be /fewer/ rails apps out than there are now, and with the >> PragBook just having hit the streets, I suspect a big spike in >> numbers >> coming soon. >> > > The original reasoning behind this feature (more conversational > discussion of app development) is still valid.I would be much happier with the status quo if environment.rb had a couple lines setting the key- and table-naming conventions to the stock values with a comment alluding to other possible values. This issue bothers me because it took so much effort to find out how to change the settings. Also, with singular table names and PKs prefixed with the table name, the stock database session support doesn''t work. I had to create my own session model. Regards, Ed -- Transmogrify, LLC * <http://xmog.com/>
San
2005-Aug-15 09:29 UTC
Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
-10. I (and I believe the silent majority) have found auto-plural a joyful ''nice touch''. If you disagree then please put up a wiki page linked to the one below describing your philosophy on why you think pluralization should be off by default and what the alternate naming convention should be. Then others of like-mind will have a resource. Unless you''re submitting a patch, the debate here is pointless and just going to be buried in the archives in a month. http://wiki.rubyonrails.com/rails/show/HowtoDisableAutoTableNamePluralisation Michael Campbell wrote:> Rob Park <rbpark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes: > > > >>Of course, having pluralisation turned off by default in future >>releases will only break all the existing applications, which is a >>cure worse than the disease,... > > > I disagree. There''s no better time than RIGHT NOW than to fix this > arbitrary and easily most confusing aspect of rails. There are never > going to be /fewer/ rails apps out than there are now, and with the > PragBook just having hit the streets, I suspect a big spike in numbers > coming soon. > >
Zachery Hostens
2005-Aug-15 20:37 UTC
Re: Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
@rob park Java! if you want strict, to the point, and *more* clearity in your software go use java! autocomplete is a feature, and as tyler said can just as easily be disabled. as for how much time it adds to pluralize words id imagine none at all. in production mode id *hope* that the pluralized phrases are computed once. so you wait .001 seconds longer for your application to start it, i think we can wait. personally i believe auto-pluralize is a nice feature and for most new people even better for them. your attempting to turn ''convention over configuration'' into ''conventionS'' and we dont want that. i dont want to look at another rails app and go "oh wth, oh they have this off, oh wait what, oh they turned this on, wait shit, and the changed this" running through code chewing your head off looking for why shit dont work is even more worse then wasting your time scrolling through a configuration file. @ed watkeys i think i would submit this in as a bug, instead of just sitting on it assuming rails is broke and no one will ever fix it :-/ the only way something will get better/fixed is if someone complains about it. On 8/15/05, San <sanzbox-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> -10. I (and I believe the silent majority) have found auto-plural a > joyful ''nice touch''. > > If you disagree then please put up a wiki page linked to the one below > describing your philosophy on why you think pluralization should be off > by default and what the alternate naming convention should be. Then > others of like-mind will have a resource. > > Unless you''re submitting a patch, the debate here is pointless and just > going to be buried in the archives in a month. > > http://wiki.rubyonrails.com/rails/show/HowtoDisableAutoTableNamePluralisation > > > Michael Campbell wrote: > > Rob Park <rbpark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes: > > > > > > > >>Of course, having pluralisation turned off by default in future > >>releases will only break all the existing applications, which is a > >>cure worse than the disease,... > > > > > > I disagree. There''s no better time than RIGHT NOW than to fix this > > arbitrary and easily most confusing aspect of rails. There are never > > going to be /fewer/ rails apps out than there are now, and with the > > PragBook just having hit the streets, I suspect a big spike in numbers > > coming soon. > > > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Zachery Hostens <zacheryph-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Michael Teter
2005-Aug-15 21:23 UTC
Re: Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
I know the horse is pretty dead, but... Everyone should be able to agree that the auto-pluralizer will never be 100% correct in the decisions it makes. Would anyone disupte that? It follows that the pluralization system CAN be a stumbling point - a point of confusion for developers. I fully understand the arguments (dead tree book exists being the most significant) for why we should keep the current system, but that''s about the only logical reason. Plain and simple, if there were no pluralization system, there would be fewer surprises. I think it was the Python people who pushed the concept of least surprise (is best), and it was a literature professor of mine who pushed the concept of removing words/phrases (features in this case) that are stumbling blocks for the reader (developer, code reviewer). Does the feature add enough convenience or benefit to outweigh the dangers/confusion? It''s difficult to draw a hard line between practical helper features and frivolous features, so I can understand how this system made it this far. But at this point I believe it should be fairly clear that the pluralization system, if it should exist at all, should be OFF by Default. Yes it would break existing sites, but Rails is new enough that chances are good the developers of those sites are still paying attention to What''s New In Rails, and thus they''d understand the need to add the one line of config to Enable the pluralization feature. If we need some reason to be fearful of dangerous or difficult-to-use features, just look at the history of C++, a language where you should buy and read at least two books just to learn what NOT to do with the language (Scott Meyers - Effective C++ series).
Tyler Kiley
2005-Aug-16 00:09 UTC
Re: Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
On 8/15/05, Michael Teter <michael.teter-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I know the horse is pretty dead, but...+1E100 (that''s scientific notation, not hex) Tyler
Rob Park
2005-Aug-16 01:08 UTC
Re: Re: Let''s call a spade a spade. [was Re: Pluralized Controller Names?]
On 8/15/05, Zachery Hostens <zacheryph-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> @rob park > Java! if you want strict, to the point, and *more* clearity in your > software go use java! autocomplete is a feature, and as tyler said > can just as easily be disabled.Programmer programmer Programmer.new(User.new(Student.new(Person.new(String.new("Rob Park"))))).addHatedObject((HatedObject)String.new("Java")); programmer.hate(); When I was a CompSci student at university, Java was the language used to teach the first year''s courses and it was a really annoying and tedious language to try and do anything at all with. What I think should be done is change rails so that if pluralisation isn''t set in environment.rb then it defaults to on, but new versions of environment.rb should come with a line disabling it. That way old apps being upgraded will still have pluralisation by default but new apps will have it turned off. Then when 2.0 comes out it can be set to disabled by default. -- Urban Artography http://artography.ath.cx