[Catalyst] model update

Jennifer Ahn jenahn at stanford.edu
Mon Feb 25 20:56:39 GMT 2008


hello!

i'm writing my first controller method to update the database using the 
catalyst model, but  i seem to have the syntax for that all wrong.

    my $obj = $c->model ('MyAppDB::Student')->update (
        { name => $name     },
        { id => $id}
        );

I'm updating the name field where the id field is given for the model 
called Student.  i'm not sure why, but the code above updates ALL row 
name fields, not just rows with the particular id.   is the syntax 
wrong? my understanding was that the first hash is to specify the set 
values and the second hash specifies the "where" clause of a query..

thanks!

jennifer





More information about the Catalyst mailing list