This project is archived and is in readonly mode.

#337 ✓resolved
Bart Zonneveld

Inflector doesn't pick up inflections

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

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"

Comments and changes to this ticket

  • Bart Zonneveld

    Bart Zonneveld June 5th, 2008 @ 09:12 AM

    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">.

  • Tarmo Tänav

    Tarmo Tänav August 23rd, 2008 @ 02:08 PM

    • 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))
    
  • Bart Zonneveld

    Bart Zonneveld August 23rd, 2008 @ 02:11 PM

    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.

  • Tarmo Tänav

    Tarmo Tänav August 23rd, 2008 @ 02:19 PM

    • 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.

  • Peter Wagenet
  • Peter Wagenet

    Peter Wagenet August 23rd, 2008 @ 06:42 PM

    • 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.

  • Repository

    Repository August 23rd, 2008 @ 08:01 PM

    • State changed from “open” to “resolved”

    (from [a652c300ac9d60f6420d1cf86632f6a3c4ceef17]) New inflectors will overwrite defaults [#337 state:resolved]

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

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Referenced by

Pages