[Catalyst] Question on Catalyst::Example::InstantCRUD

Lars Balker Rasmussen lars at balker.dk
Thu Jun 1 01:05:55 CEST 2006


On Wed, May 31, 2006 at 02:30:31PM +0100, Jonas Alves wrote:
> Hi, i'm working on a patch to IntantCRUD that handles that  
> automatically.
> It isn't finished yet, but already do the following:
> 
> - Adds the 'use overload '""' => sub { shift->$primary_key },  
> fallback=> 1;' line to the schema classes.

How is this helpful?

The current problem is that DBIC stringifies objects to their 
primary key by default.  So, if you have a primary key that is
an id (integer), it usually does not make sense to end users.
In that case you want the stringification to apply to something
else.

In my experience, a "meaningful" string usually makes a terrible
primary key, because you'll probably want to change it down the 
road.
-- 
Lars Balker Rasmussen                                        Consult::Perl



More information about the Catalyst mailing list