Repost: Pluralization of non-noun names


#1

People,

I didn’t get an answer to this before so I am trying again:

I could change an existing “policy” table to “policies” with no drama
but the are a number of related tables ie:

p_2quot
p_addr
p_cc
p_cs
p_direct
p_div
p_exss
p_ll
p_mp
p_note
p_prop
p_prov
p_rent
p_rnwl
p_sdiv
p_seq
p_wrkrs
p_xaddr

Each policy may or may not have a corresponding record in one of these
other tables - if it does it could be a one-to-many or a one-to-one
relationship. Is there a way to create new nouns in RoR so that I could
create the corresponding plurals like:

p_2quots
p_addrs
p_ccs
.
.
etc

and the system would work as normal?

Thanks,

Phil.

Philip R.

Pricom Pty Limited (ACN 003 252 275 ABN 91 003 252 275)
GPO Box 3411
Sydney NSW 2001
Australia
Mobile: +61:(0)411-185-652
Fax: +61:(0)2-8221-9599
E-mail: removed_email_address@domain.invalid


#2

click the following link, you may get some useful info…
http://nubyonrails.com/tools/pluralize


#3

Hey Philip, pluralization works on english words instead of variables.
Thus, I would recommend do the following:

  1. just simply rename the offending tables because it seems that some
    wouldn’t
    produce a valid pluralization to begin with. However, you maybe
    able to create
    a mapping with rails that should prevent you from changing the
    actual table names.

If someone on the list knows a solution for this rails user, please
post to the mailist.

Peace,

-Conrad


#4

Arun,

Thanks for that! - the pluralizer seems to work on my non-english nouns!

Regards,

Phil.

On Sat, 2006-05-20 at 10:04 +0530, Arun kumar wrote:

    I could change an existing "policy" table to "policies" with
    p_ll
    
    p_ccs 
    Philip R.
    _______________________________________________
    Rails mailing list 
    removed_email_address@domain.invalid
    http://lists.rubyonrails.org/mailman/listinfo/rails


Philip R.

Pricom Pty Limited (ACN 003 252 275 ABN 91 003 252 275)
GPO Box 3411
Sydney NSW 2001
Australia
Mobile: +61:(0)411-185-652
Fax: +61:(0)2-8221-9599
E-mail: removed_email_address@domain.invalid