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.

Inflector doesn't pick up inflections

#337

I found out that 'series'.singularize returns 'series' instead of 'serie', although I specified it in the inflections initializer.

Steps to reproduce:

  • create rails app
  • freeze rails to edge
  • add inflect.irregular 'serie', 'series' to inflections initializer
  • fire up the console:

Loading development environment (Rails 2.1.0)

>> 'series'.singularize

=> "series"

>> Serie.class_name

=> "Series"

Reported by Bart Zonneveld · June 5th, 2008 @ 09:00 AM

State: resolved
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Bart Zonneveld
    Bart Zonneveld

    I added 'serie' => 'series' to the Irregularities in inflector_test_cases.rb and got this as test result:

    1) Failure:

    test_irregularity_between_serie_and_series(InflectorTest)

    [./test/inflector_test.rb:189:in `test_irregularity_between_serie_and_series'

    ./test/../lib/active_support/testing/setup_and_teardown.rb:67:in `__send__'

    ./test/../lib/active_support/testing/setup_and_teardown.rb:67:in `run']:

    <"serie"> expected but was

    <"series">.

    June 5th, 2008 @ 09:12 AM

  2. Tarmo Tänav
    Tarmo Tänav
    • State changed from new to invalid
    • Tag set to activesupport, bug, edge

    Hi, this happens because series is uncountable, meaning that its singular form is the same as its plural:

    
    inflect.uncountable(%w(equipment information rice money species series fish sheep))
    

    August 23rd, 2008 @ 02:08 PM

  3. Bart Zonneveld
    Bart Zonneveld

    Yeah it does, but it's kinda funky that custom inflections are overruled by the default uncountables. This isn't documented, and, imho, unwanted behaviour.

    August 23rd, 2008 @ 02:11 PM

  4. Tarmo Tänav
    Tarmo Tänav
    • State changed from invalid to open

    Yeah, I guess this could be patched so later rules would override previous ones, I however have no idea how simple or difficult that might be, feel free to investigate.

    August 23rd, 2008 @ 02:19 PM

  5. Peter Wagenet
  6. Peter Wagenet
    Peter Wagenet
    • Tag changed from activesupport, bug, edge to activesupport, bug, edge, patch, tested

    This is pretty easy to fix. I've attached a patch with a fix and tests.

    August 23rd, 2008 @ 06:42 PM

  7. Repository
    Repository
    • State changed from open to resolved

    (from [a652c300ac9d60f6420d1cf86632f6a3c4ceef17]) New inflectors will overwrite defaults [#337 Inflector doesn't pick up inflections state:resolved]

    Signed-off-by: Tarmo Tänav tarmo@itech.ee http://github.com/rails/rails/co...

    August 23rd, 2008 @ 08:01 PM