[Dbix-class] DBIx::Class:Schema::Loader has_many relationship names

Brandon Black blblack at gmail.com
Fri Feb 24 15:04:21 CET 2006


On 2/24/06, Brandon Black <blblack at gmail.com> wrote:
> On 2/24/06, Adam Sjøgren <asjo at koldfront.dk> wrote:
> > On Fri, 24 Feb 2006 12:42:02 +0000, Matt wrote:
> >
> > > That's because the default inflect code doesn't handle plurals - if you
> > > want non-default behaviour, pass it an inflect_map option.
> >
> > (Ok - I was trying to ask what the default behaviour is supposed to be
> > :-))
> >
> > > I can see your reasoning but the vast majority of users (I think) have
> > > singular table names rather than plural, so the default config caters to
> > > that.
> >
> > Ok, that makes sense (the default working with what most people do).
> >
> > Do most people really name their tables in the singular? I find that
> > quite confusing.
> >
> >
>
> I also make my table names plural, although in light of all the
> discussions that have popped up from this, I'll probably change that
> habit next time around.
>
> When making the has_many name, Loader uses
> Lingua::EN::Inflect::pluralize on the table name.
> Lingua::EN::Inflect::pluralize docs say the result is"undefined" when
> you pass in an already plural name (but the result tends to really be
> that it strips pluralization).
>
> It needs a better solution, I just haven't though of one yet.
>

But then again, like mst said, you can do:

inflect_map => sub { $_ },

in the args, and it should stop trying to pluralize.

Perhaps there should be an intuitive option to just turn off
inflections.  Either inflections => 0, or inflect_map => undef, or
something.

-- Brandon



More information about the Dbix-class mailing list