Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Strings That End in class Are Not Properly Singularized

#1521

This is minor, but inflections.rb probably should have a case for strings that look like /^(.)class$/ and perhaps even more generic as /^(.)ss$/

Currently, calling "event_class".singularize returns "event_clas" Adding inflect.singular /^(.*)class$/, '\1class' fixes it.

I noticed that inflections.rb you already have a special case to handle trailing 'ss' : inflect.plural(/(x|ch|ss|sh)$/i, '\1es') inflect.singular(/(x|ch|ss|sh)es$/i, '\1')

but since most strings that already are singular are properly handled when calling singularize ("foo".singularize returns "foo") it probably makes sense to handle the case of "class".singularize == "class"

Thanks

Reported by Seth Ladd · December 5th, 2008 @ 11:02 PM

State: invalid
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Frederick Cheung
    Frederick Cheung
    • State changed from new to invalid

    To quote inflector.rb:

    The Rails core team has stated patches for the inflections library will not be accepted in order to avoid breaking legacy applications which may be relying on errant inflections. If you discover an incorrect inflection and require it for your application, you'll need to correct it yourself (explained below).

    Sorry!

    December 7th, 2008 @ 02:47 PM