>> "territories".pluralize=> "territory">> "queries".pluralize=> "query" This matches the rule: [/([^aeiouy]|qu)ies$/i, "\\1y" Is this a bug, or are there times where a word ending in "ies" should be pluralized with "y"? I tried to create a ticket for this issue, bu track keeps giving me the error "Akismet rejected spam" Thanks, Mark -- Mark Van Holstyn mvette13@gmail.com http://lotswholetime.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core -~----------~----~----~----~------~----~------~--~---
On Aug 23, 2006, at 23:32, Mark Van Holstyn wrote:> >> "territories".pluralize > => "territory" > >> "queries".pluralize > => "query"I''m curious. What would you expect them to be pluralized as? "territorieses" and "querieses"? -- Jakob Skjerning - http://mentalized.net --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core -~----------~----~----~----~------~----~------~--~---
On 8/24/06, Jakob Skjerning <jakob@mentalized.net> wrote:> > > On Aug 23, 2006, at 23:32, Mark Van Holstyn wrote: > > > >> "territories".pluralize > > => "territory" > > >> "queries".pluralize > > => "query" > > I''m curious. What would you expect them to be pluralized as? > "territorieses" and "querieses"? >I would expect it to return the word unchanged, as per the examples given in the docs: http://caboo.se/doc/classes/ActiveSupport/CoreExtensions/String/Inflections.html#M004173 ... "sheep".pluralize #=> "sheep" "words".pluralize #=> "words" "the blue mailman".pluralize #=> "the blue mailmen" Although that behavior should probably also be specified in the rdoc in addition to examples. Maybe "if you pass in a string already pluralized or a string for which no valid pluralization exists, the string is returned unchanged." - Rob -- http://www.robsanheim.com http://www.seekingalpha.com http://www.ajaxian.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core -~----------~----~----~----~------~----~------~--~---
The docs are wrong. pluralize has always returned a singular when given a plural. On 8/23/06, Rob Sanheim <rsanheim@gmail.com> wrote:> > On 8/24/06, Jakob Skjerning <jakob@mentalized.net> wrote: > > > > > > On Aug 23, 2006, at 23:32, Mark Van Holstyn wrote: > > > > > >> "territories".pluralize > > > => "territory" > > > >> "queries".pluralize > > > => "query" > > > > I''m curious. What would you expect them to be pluralized as? > > "territorieses" and "querieses"? > > > > I would expect it to return the word unchanged, as per the examples > given in the docs: > http://caboo.se/doc/classes/ActiveSupport/CoreExtensions/String/Inflections.html#M004173 > > ... > "sheep".pluralize #=> "sheep" > "words".pluralize #=> "words" > "the blue mailman".pluralize #=> "the blue mailmen" > > Although that behavior should probably also be specified in the rdoc > in addition to examples. Maybe "if you pass in a string already > pluralized or a string for which no valid pluralization exists, the > string is returned unchanged." > > - Rob > -- > http://www.robsanheim.com > http://www.seekingalpha.com > http://www.ajaxian.com > > > >-- Kevin Clark http://glu.ttono.us --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core -~----------~----~----~----~------~----~------~--~---
> I''m curious. What would you expect them to be pluralized as? > "territorieses" and "querieses"?I agree with Rob. The docs are wrong. pluralize has always returned a singular when> given a plural.It makes no sense to return the singularized work. Currently, the word IS returned unchanges, except for the *ies words. -- Mark Van Holstyn mvette13@gmail.com http://lotswholetime.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core -~----------~----~----~----~------~----~------~--~---
On 8/24/06, Kevin Clark <kevin.clark@gmail.com> wrote:> > The docs are wrong. pluralize has always returned a singular when > given a plural. >Are you talking about pluralize in text helper, or the extension to String? Because thats not the case when using it with a regular ole'' string: This is with rails 1.1.6: C:\dev\workspace_myec\madrails>ruby script/console Loading development environment.>> "dogs".pluralize=> "dogs">> "cats".pluralize=> "cats">> a = "table"=> "table">> a.pluralize=> "tables">> a.pluralize=> "tables">>Maybe the helpers work differently...though from glancing at the source it doesn''t look it. Any why would pluralize return the singular form? Thats what "singularize" is for, after all. - Rob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core -~----------~----~----~----~------~----~------~--~---
Hi! (rails 1.1.6, script/console, win32) Loading development environment.>> "queries".pluralize=> "query">> "dogs".pluralize=> "dogs" So pluralize actually singularizes words ending with ''ies'', but leaves those dogs in group. Sounds like a bug to me (or at least, an inconsistent behaviour which could be clarified - I''d expect pluralize to leave the plural form unaffected). Thibaut --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core -~----------~----~----~----~------~----~------~--~---
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Thibaut Barrère wrote:> Hi! > > (rails 1.1.6, script/console, win32) > Loading development environment. >>> "queries".pluralize > => "query" >>> "dogs".pluralize > => "dogs" > > So pluralize actually singularizes words ending with ''ies'', but leaves > those dogs in group. > > Sounds like a bug to me (or at least, an inconsistent behaviour which > could be clarified - I''d expect pluralize to leave the plural form > unaffected).+1 Zach -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFE9PG+Myx0fW1d8G0RAtf9AJ9zuaSZjbQfxNOPkYi7pG7S3HJBLACfS0Bk DbRGfGpV/suut+EyCi+vY5c=fXZ5 -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core -~----------~----~----~----~------~----~------~--~---
This is a bug in activesupport/lib/active_support/inflections.rb Somehow the singular form is included as a plural form, immediately after the plural, so what happens in the Inflector.pluralize method call is queries.pluralize -> query -> queries Anyway it''s a trivial fix: Index: ../lib/active_support/inflections.rb ==================================================================--- ../lib/active_support/inflections.rb (revision 4867) +++ ../lib/active_support/inflections.rb (working copy) @@ -11,7 +11,6 @@ inflect.plural(/(?:([^f])fe|([lr])f)$/i, ''\1\2ves'') inflect.plural(/(hive)$/i, ''\1s'') inflect.plural(/([^aeiouy]|qu)y$/i, ''\1ies'') - inflect.plural(/([^aeiouy]|qu)ies$/i, ''\1y'') inflect.plural(/(x|ch|ss|sh)$/i, ''\1es'') inflect.plural(/(matr|vert|ind)ix|ex$/i, ''\1ices'') inflect.plural(/([m|l])ouse$/i, ''\1ice'') And a test to prove that the fix, ''fixes'' the problem: Index: inflector_test.rb ==================================================================--- inflector_test.rb (revision 4867) +++ inflector_test.rb (working copy) @@ -200,6 +200,10 @@ "person_street_address" => "person-street-address" } + def test_strange_pluralize + assert_equal "queries", Inflector.pluralize("queries") + end + --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core -~----------~----~----~----~------~----~------~--~---
8/30/06, foamdino <foamdino@gmail.com> wrote:> > This is a bug in activesupport/lib/active_support/inflections.rb > > Somehow the singular form is included as a plural form, immediately > after the plural, so what happens in the Inflector.pluralize method > call is > queries.pluralize -> query -> queries > > Anyway it''s a trivial fix:The inflector is basically frozen, prior to 1.0 we''d add lots of new rules to fix bugs, and just end up enraging people who looked at the old output and named their tables accordingly. You can add those exceptions yourself in environment.rb. -- Cheers Koz --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core -~----------~----~----~----~------~----~------~--~---
On 8/29/06, foamdino <foamdino@gmail.com> wrote:> > > This is a bug in activesupport/lib/active_support/inflections.rb > > Somehow the singular form is included as a plural form, immediately > after the plural, so what happens in the Inflector.pluralize method > call is > queries.pluralize -> query -> queriesSounds good. http://dev.rubyonrails.org/changeset/4868 jeremy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core -~----------~----~----~----~------~----~------~--~---
On 8/29/06, Michael Koziarski <michael@koziarski.com> wrote:> > The inflector is basically frozen, prior to 1.0 we''d add lots of new > rules to fix bugs, and just end up enraging people who looked at the > old output and named their tables accordingly. You can add those > exceptions yourself in environment.rb.My bad. This one seemed bunk, probably an old typo. jeremy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core -~----------~----~----~----~------~----~------~--~---
> > The inflector is basically frozen, prior to 1.0 we''d add lots of new > > rules to fix bugs, and just end up enraging people who looked at the > > old output and named their tables accordingly. You can add those > > exceptions yourself in environment.rb. > > > My bad. This one seemed bunk, probably an old typo.I did say *basically* frozen, you just agree to fix any breakages ;) -- Cheers Koz --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core -~----------~----~----~----~------~----~------~--~---
Thanks for the fix! Mark On 8/30/06, Michael Koziarski <michael@koziarski.com> wrote:> > > > > The inflector is basically frozen, prior to 1.0 we''d add lots of new > > > rules to fix bugs, and just end up enraging people who looked at the > > > old output and named their tables accordingly. You can add those > > > exceptions yourself in environment.rb. > > > > > > My bad. This one seemed bunk, probably an old typo. > > I did say *basically* frozen, you just agree to fix any breakages ;) > > > -- > Cheers > > Koz > > > >-- Mark Van Holstyn mvette13@gmail.com http://lotswholetime.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core -~----------~----~----~----~------~----~------~--~---