Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: DBIx::Class foreign key update woes

by castaway (Parson)
on Jul 18, 2006 at 20:52 UTC ( #562125=note: print w/ replies, xml ) Need Help??


in reply to DBIx::Class foreign key update woes

Hi Phil,
If you turn on SQL debugging (set DBIX_CLASS_STORAGE_DBI_DEBUG to true in your environment), you'll notice that the status object gets fetched when you first try to access ->descr, and isn't refetched when you just change a column entry in the check object. It would indeed be nice if that magically updated a related object, and I'll propose it.

In the meantime you can do either:

my $newstatus = $schema->resultset('Status')->find(2); $check->status($newstatus);
or:
$check->update({status => 2}); $check->discard_changes();
It's not as pretty.. but it works.

C.


Comment on Re: DBIx::Class foreign key update woes
Select or Download Code
Re^2: DBIx::Class foreign key update woes
by philcrow (Priest) on Jul 18, 2006 at 21:07 UTC
    Thanks for the advice. It worked in my test.

    As for:

    It would indeed be nice if that magically updated a related object
    I don't need it to update that other object, just discard what it's holding so additional accesses will refetch it.

    Phil

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://562125]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2014-07-12 07:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (238 votes), past polls