addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcredit-cardcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobe--smallglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1launch-new-window--smalllight-bulblinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

Re: [ruby-81] I hate pluralization!

From: Chad W.
Sent on: Tuesday, January 29, 2008 10:35 PM
On Jan 29,[masked]:43 PM, Loqi <[address removed]> wrote:
> Everything was back on track until I started going RESTful. Rails
> RESTful routing appears to rely on each identifier having two
> distinct spellings for singular and plural forms in order to
> function. I consider this a bug, not a desirable condition. I can
> only hope the Rails team would agree that relying on an artifact of
> the English language in order to keep your code from crashing is a
> brittle solution.

The route helper forms aren't too bad, once you learn the convention.
I always keep the PeepCode REST Cheatsheet handy:

http://topfunky.c...­

As for controllers, one sensible convention is to pluralize regular
controllers/resource­s, and singularize singleton
controllers/resource­s.

Also, you should be able to make your routes and URLs be whatever you
want with name_prefix, path_prefix, etc.  Again, see the cheatsheet.

It also helps greatly to write tests for your routes, to ensure that
your routes and route helpers are always what you think they should
be.

-- Chad

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy