from ''generate scaffold'': "If a controller name is not given, the plural form of the model name will be used. The model and controller names may be given in CamelCase or under_score and should not be suffixed with ''Model'' or ''Controller''. Both model and controller names may be prefixed with a module like a file path; see the Modules Example for usage." Isn''t this the complete opposite of the whole singularization philosophy? I thought controllers were supposed to be singular. But it doesn''t work anyhow:> generate scaffold AbcYou have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occured while evaluating nil.include? csn __________________________________ Yahoo! FareChase: Search multiple travel sites in one click. http://farechase.yahoo.com
Jeremy Kemper
2005-Nov-15 03:11 UTC
Re: Why default to plural controller in generate scaffold?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Nov 14, 2005, at 6:25 PM, CSN wrote:> from ''generate scaffold'': > > "If a controller name is not given, the plural form of > the model name will be used. The model and controller > names may be given in CamelCase or under_score and > should not be suffixed with ''Model'' or ''Controller''. > Both model and controller names may be prefixed with a > module like a file path; see the Modules Example for > usage." > > Isn''t this the complete opposite of the whole > singularization philosophy? I thought controllers were > supposed to be singular.Not sure about that. Explain?> But it doesn''t work anyhow: > >> generate scaffold Abc > You have a nil object when you didn''t expect it! > You might have expected an instance of Array. > The error occured while evaluating nil.include?This bug has been fixed in the next release. Please specify both model and controller name: script/generate scaffold Abc Abc jeremy -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (Darwin) iD8DBQFDeVHkAQHALep9HFYRAhlHAKDdvBy4dYxrAjrNZBihiKlsHgdq4QCdFQuR jq+6qzPF0i3HmT0s1omyddg=Ehvk -----END PGP SIGNATURE-----
--- Jeremy Kemper <jeremy-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org> wrote:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On Nov 14, 2005, at 6:25 PM, CSN wrote: > > from ''generate scaffold'': > > > > "If a controller name is not given, the plural > form of > > the model name will be used. The model and > controller > > names may be given in CamelCase or under_score and > > should not be suffixed with ''Model'' or > ''Controller''. > > Both model and controller names may be prefixed > with a > > module like a file path; see the Modules Example > for > > usage." > > > > Isn''t this the complete opposite of the whole > > singularization philosophy? I thought controllers > were > > supposed to be singular. > > Not sure about that. Explain?Everything I''ve read in Rails states that tables should be singularized when creating models and controllers, e.g. items table -> Item controller, Item model. Seems like the default should be to create a singular model. Or at least match the inflection of the controller. csn __________________________________ Yahoo! Mail - PC Magazine Editors'' Choice 2005 http://mail.yahoo.com
Gabe Boyer
2005-Nov-15 05:07 UTC
Re: Why default to plural controller in generate scaffold?
On 11/14/05, CSN <cool_screen_name90001-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> > --- Jeremy Kemper <jeremy-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org> wrote: > > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > On Nov 14, 2005, at 6:25 PM, CSN wrote: > > > from ''generate scaffold'': > > > > > > "If a controller name is not given, the plural > > form of > > > the model name will be used. The model and > > controller > > > names may be given in CamelCase or under_score and > > > should not be suffixed with ''Model'' or > > ''Controller''. > > > Both model and controller names may be prefixed > > with a > > > module like a file path; see the Modules Example > > for > > > usage." > > > > > > Isn''t this the complete opposite of the whole > > > singularization philosophy? I thought controllers > > were > > > supposed to be singular. > > > > Not sure about that. Explain? > > Everything I''ve read in Rails states that tables > should be singularized when creating models and > controllers, e.g. items table -> Item controller, Item > model. Seems like the default should be to create a > singular model. Or at least match the inflection of > the controller. > > csn > > > > > > __________________________________ > Yahoo! Mail - PC Magazine Editors'' Choice 2005 > http://mail.yahoo.com > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >While it''s true that Rails defaults would lead you to have an items table -> Item model, I don''t believe I''ve heard anyone apply the same convention to controller names. As far as I''ve seen, most people seem to use singular/plural controller names interchangeably, depending on the specific case, and what they prefer. Gabe
Gabe Boyer
2005-Nov-15 05:11 UTC
Re: Why default to plural controller in generate scaffold?
On 11/14/05, Gabe Boyer <gboyer-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 11/14/05, CSN <cool_screen_name90001-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote: > > > > --- Jeremy Kemper <jeremy-w7CzD/W5Ocjk1uMJSBkQmQ@public.gmane.org> wrote: > > > > > -----BEGIN PGP SIGNED MESSAGE----- > > > Hash: SHA1 > > > > > > On Nov 14, 2005, at 6:25 PM, CSN wrote: > > > > from ''generate scaffold'': > > > > > > > > "If a controller name is not given, the plural > > > form of > > > > the model name will be used. The model and > > > controller > > > > names may be given in CamelCase or under_score and > > > > should not be suffixed with ''Model'' or > > > ''Controller''. > > > > Both model and controller names may be prefixed > > > with a > > > > module like a file path; see the Modules Example > > > for > > > > usage." > > > > > > > > Isn''t this the complete opposite of the whole > > > > singularization philosophy? I thought controllers > > > were > > > > supposed to be singular. > > > > > > Not sure about that. Explain? > > > > Everything I''ve read in Rails states that tables > > should be singularized when creating models and > > controllers, e.g. items table -> Item controller, Item > > model. Seems like the default should be to create a > > singular model. Or at least match the inflection of > > the controller. > > > > csn > > > > > > > > > > > > __________________________________ > > Yahoo! Mail - PC Magazine Editors'' Choice 2005 > > http://mail.yahoo.com > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > While it''s true that Rails defaults would lead you to have an items > table -> Item model, I don''t believe I''ve heard anyone apply the same > convention to controller names. As far as I''ve seen, most people seem > to use singular/plural controller names interchangeably, depending on > the specific case, and what they prefer. > > Gabe >"Interchangeably" might have been a poor choice of words; that implies someone might use both singular and plural forms to refer to the same controller. Of course, I meant that someone might use the singular form for one controller name (i.e. ItemsController), and the plural form for another (i.e. BlogController). :) Gabe
Craig Webster
2005-Nov-15 09:20 UTC
Re: Why default to plural controller in generate scaffold?
> Of course, I meant that someone might use the singular > form for one controller name (i.e. ItemsController), and the plural > form for another (i.e. BlogController).I prefer the other way around ;) Plural = ItemsController Singular = BlogController Craig -- Craig Webster | web: http://xeriom.net/ | Monkey see, monkey do: Okay. Xeriom.NET | tel: +44 (0)131 516 8595 | Monkey top post: Bad monkey.
Gabe Boyer
2005-Nov-15 14:45 UTC
Re: Why default to plural controller in generate scaffold?
On 11/15/05, Craig Webster <craig-07VhxHapISisTnJN9+BGXg@public.gmane.org> wrote:> > Of course, I meant that someone might use the singular > > form for one controller name (i.e. ItemsController), and the plural > > form for another (i.e. BlogController). > > I prefer the other way around ;) > Plural = ItemsController > Singular = BlogController > > Craig > -- > Craig Webster | web: http://xeriom.net/ | Monkey see, monkey do: Okay. > Xeriom.NET | tel: +44 (0)131 516 8595 | Monkey top post: Bad monkey. > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >Hmm. Now that you mention it, I think I like your way better. :) Gabe