How to correct pluralization?

Hi all!

Is it possible to add rules to rails’ inflector so I can have

posses -> posse (thinks it’s “poss”)

and

hero -> heroes (thinks it’s “heros”)

Thank you!

Hi –

On 3/16/07, Damian T. [email protected] wrote:

Hi all!

Is it possible to add rules to rails’ inflector so I can have

posses → posse (thinks it’s “poss”)

and

hero → heroes (thinks it’s “heros”)

Yes – see the examples at the bottom of config/environment.rb.

David


Q. What is THE Ruby book for Rails developers?
A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black)
(See what readers are saying! http://www.rubypal.com/r4rrevs.pdf)
Q. Where can I get Ruby/Rails on-site training, consulting, coaching?
A. Ruby Power and Light, LLC (http://www.rubypal.com)

On Fri, Mar 16, 2007 at 05:23:24PM +0300, Damian T. wrote :

Is it possible to add rules to rails’ inflector so I can have

posses -> posse (thinks it’s “poss”)

and

hero -> heroes (thinks it’s “heros”)

Add in your environment.rb:
Inflector.inflections do |inflect|
inflect.irregular ‘posses’, ‘posse’
inflect.irregular ‘hero’, ‘heroes’
end

P.S.: what’s poss/posses ???


,========================.
| Pierre-Alexandre M. |
| email : [email protected] |
`========================’

A “posse” is a group of armed men, generally who would go out and
round up a wanted criminal. Circa 1800’s in the American West.

On 3/16/07, Damian T. [email protected] wrote:

Hi all!

Is it possible to add rules to rails’ inflector so I can have

posses → posse (thinks it’s “poss”)

and

hero → heroes (thinks it’s “heros”)

Sounds like a pretty cool app…


Rick O.
http://lighthouseapp.com
http://weblog.techno-weenie.net
http://mephistoblog.com

On Fri, Mar 16, 2007 at 02:59:25PM -0000, [email protected] wrote
:

A “posse” is a group of armed men, generally who would go out and
round up a wanted criminal. Circa 1800’s in the American West.

Oh, yes! Party Posse feat. Bart!

Yvan eht nioj…

The Simpsons are my second family.


,========================.
| Pierre-Alexandre M. |
| email : [email protected] |
`========================’

Hi Damian, the correrct pluralization for hero is heroes.

Good luck,

-Conrad

Hi Damian, it seems that posse by definition is already plural. Also,
there isn’t a word in the dictionary called ‘posses’. This would be
considered a special case where both the singular and plural form is
the same, posse. Thus,

“posse”.singularize
=> “posse”

Thus, I would the following to your environment.rb:

Inflector.inflections do |inflect|
inflect.irregular ‘posse’, ‘posse’
inflect.irregular ‘hero’, ‘heroes’
end

Good luck,

-Conrad

On Mar 17, 2007, at 11:00, Conrad T. wrote:

Hi Damian, it seems that posse by definition is already plural. Also,
there isn’t a word in the dictionary called ‘posses’. This would be
considered a special case where both the singular and plural form is
the same, posse.

Thanks, I’ll make it uncountable.

On Mar 17, 2007, at 11:00, Conrad T. wrote:

Hi Damian, it seems that posse by definition is already plural.

Checked Wiktionary — it says plural is “posses”. Well, posse is a
group, but why there couldn’t be groups?

Hi, thank you very much.

On Mar 16, 2007, at 17:32, Pierre-Alexandre M. wrote:

P.S.: what’s poss/posses ???

1 : a large group often with a common interest
2 : a body of persons summoned by a sheriff to assist in preserving the
public peace usually in an emergency
3 : a group of people temporarily organized to make a search (as for a
lost child)
4 : entourage 1

(www.webster.com)

I mean, Rails has problems guessing singular from plural here.

Yours sincerely,
Damian/Three-eyed Fish