I love the simply_restful plugin (beautiful work Jamis) but wonder why the naming convention changed to look for pluralized controllers by default. If you do: map.resource :message then you must have a MessagesController. If you already have a MessageController you need: map.resource :message, :controller => ''message'' which is slightly less DRY. Is this a change in convention to pluralize controller names? Almost all the examples in the docs and rails books use singular controller names. I''d be happy to make a patch if this is an unwanted side-effect of the plugin. Thanks, Zack Chandler
On Jun 28, 2006, at 10:18 AM, Zack Chandler wrote:> I love the simply_restful plugin (beautiful work Jamis) but wonder why > the naming convention changed to look for pluralized controllers by > default. > > If you do: > map.resource :message > then you must have a MessagesController. > > If you already have a MessageController you need: > map.resource :message, :controller => ''message'' > which is slightly less DRY. > > Is this a change in convention to pluralize controller names? Almost > all the examples in the docs and rails books use singular controller > names. I''d be happy to make a patch if this is an unwanted > side-effect of the plugin.simply_restful addresses collections of resources and their members so pluralization feels natural. (The scaffold generator has used pluralized names for months, too.) jeremy
Zack, The pluralization is intentional. This is because of the collection- oriented nature of resources. If you have a "message" resource, you get the collection of all messages at "/messages", and a single message at "/messages/2". The controller itself manages "messages" (serves up either the collection, or any number of messages one at a time). - Jamis On Jun 28, 2006, at 11:18 AM, Zack Chandler wrote:> I love the simply_restful plugin (beautiful work Jamis) but wonder why > the naming convention changed to look for pluralized controllers by > default. > > If you do: > map.resource :message > then you must have a MessagesController. > > If you already have a MessageController you need: > map.resource :message, :controller => ''message'' > which is slightly less DRY. > > Is this a change in convention to pluralize controller names? Almost > all the examples in the docs and rails books use singular controller > names. I''d be happy to make a patch if this is an unwanted > side-effect of the plugin. > > Thanks, > Zack Chandler > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-core
Jeremy, Jamis, Thanks for clarifying the intention behind this choice. I had posted a similar question to a recent loudthinking post and the response (see below) leads me to believe there may be a few more changes ahead. <snip from http://www.loudthinking.com/arc/000593.html> Challenge by DHH on June 28, 19:10 Zack, we''re changing it so you''re going to say map.resources :messages. That way the convention will be consistent. </snip> Thanks again, Zack On 6/28/06, Jamis Buck <jamis@37signals.com> wrote:> Zack, > > The pluralization is intentional. This is because of the collection- > oriented nature of resources. If you have a "message" resource, you > get the collection of all messages at "/messages", and a single > message at "/messages/2". The controller itself manages > "messages" (serves up either the collection, or any number of > messages one at a time). > > - Jamis > > On Jun 28, 2006, at 11:18 AM, Zack Chandler wrote: > > > I love the simply_restful plugin (beautiful work Jamis) but wonder why > > the naming convention changed to look for pluralized controllers by > > default. > > > > If you do: > > map.resource :message > > then you must have a MessagesController. > > > > If you already have a MessageController you need: > > map.resource :message, :controller => ''message'' > > which is slightly less DRY. > > > > Is this a change in convention to pluralize controller names? Almost > > all the examples in the docs and rails books use singular controller > > names. I''d be happy to make a patch if this is an unwanted > > side-effect of the plugin. > > > > Thanks, > > Zack Chandler > > _______________________________________________ > > Rails-core mailing list > > Rails-core@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-core > > _______________________________________________ > Rails-core mailing list > Rails-core@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-core >