Pluralization of non-noun names

People,

I have an insurance company client and for the last eleven years I have
wanted to completely redevelop their system from scratch. However, the
boss has never been interested in hiring a team to develop the new
system (partly because of the cost and partly because of some famous and
expensive development failures in the industry) and has always insisted
on incremental development of the old system. Needless to say, this has
constrained implementation of new technologies/features etc (not to
mention making maintenance and development of the existing system more
difficult).

I am now convinced that RoR could actually do the redevelopment job with
only a slight expansion to our existing development team and at a cost
that would not be much more than our usual developer costs. There are
however a few problems, the most obvious that I can see is the
pluralization thing. I could change the 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 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: [email protected]

Why not just disable table pluralization? Do that by adding the
following
line to ‘config/environment.rb’:

ActiveRecord http://dev.radrails.org/trac/wiki/ActiveRecord::
Base.pluralize_table_names = false

According to good database design, database table names should not be
pluralized anyway. Disabling pluralization is first thing I do when
starting
a new Rails project, and you can then forget about adding irregular
inflections or incorrect noun pluralization. A bonus side effect is that
you
never have to worry about table name conflicts with engines or plugins,
because the add-in tables will remain pluralized, indicating they are
not
part of your core application.

Daniel Butler

David,

OK, thanks for the useful points but then I presume I have to do
manually what would normally be done automatically? eg

table: policies
-> Policies
-> Policy
-> policy

in appropriate places?

Regards,

Phil.

On Fri, 2006-05-12 at 15:14 -0400, Daniel Butler wrote:

engines or plugins, because the add-in tables will remain pluralized,
wanted to completely redevelop their system from
(not to
however a few problems, the most obvious that I can see is the
p_div
p_wrkrs
p_2quots
Phil.

    _______________________________________________ 
    Rails mailing list
    [email protected]
    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: [email protected]