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.
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:
or:my $newstatus = $schema->resultset('Status')->find(2); $check->status($newstatus);
It's not as pretty.. but it works.$check->update({status => 2}); $check->discard_changes();
C.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: DBIx::Class foreign key update woes
by philcrow (Priest) on Jul 18, 2006 at 21:07 UTC |
In Section
Seekers of Perl Wisdom