THANK YOU, that's all I need to know.
"Hermida, Leandro" <[EMAIL PROTECTED]> wrote:
Hello,
I am no DBIx::Class expert but I think one way of doing it is first
using the primary key or a unique constraint of the table Book to
find the object you want and then update it. Something like
this:
my $book = $c->model('MyApp::Book')->find($book_pk_id);
$book->title($new_title);
$book->rating($new_rating);
$book->update;
Leandro
________________________________
From: Will Smith [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 06, 2006 21:53
To: catalyst
Subject: [Catalyst] html::widget
Hi,
It's pretty neat to use html::widget to create/validate html
form. Problem is I need to create a lot of customized html forms that
could not done easily with html::widget. I want to simply do my own html
form and use a normal action to update the record.
I tried to use somehing like:
my $book = $c->model('myapp::Book')->update({
title => $title,
rating => $rating,
});
but of course, it updates the whole table, not only the wanted
record, because I do not put in the condition "where".
I used to use : update_from_form in older version of catalyst.
Could someone please show me the syntax to do the update, either
adding condition to the above method (which I think there is a simple
way), or using update_from_form
something like the old timer:
$c->for( optional => [ myapp::M::CDBI::books->columns ] );
..
myapp::M::CDBI::books->retrieve($id)->update_from_form(
$c->form);
Thank you
_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/
---------------------------------
Need a quick answer? Get one in minutes from people who know. Ask your question
on Yahoo! Answers._______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/