[Catalyst] DBIC Create: Objects in DB?
Dennis Daupert
ddaupert at sbcglobal.net
Sat Dec 31 21:21:02 CET 2005
I used perl script to populate 3 records into my users table,
and they look like this (command line query):
1,Skeeter,Nitney,snitney,pass,snitney at bigtux,1
2,Suzie,Creamcheese,screamcheeze,pass,screamcheeze at bigtux,1
3,Goober,Pease,gpease,pass,gpease at bigtux,1
But when I do a DBIx-Class insert, my db record looks like this:
,MyApp2=HASH(0x19970a0)->req->params->{fname},MyApp2=HASH(0x19970a0)->req->params->{lname},MyApp2=HASH(0x19970a0)->req->params->{username},MyApp2=HASH(0x19970a0)->req->params->{password},MyApp2=HASH(0x19970a0)->req->params->{email},1
Is that correct? Is DBIC set up to insert objects into
the database? If so, then the list function I got working
last night is wrong.
(Andy, thanks for your post; I saw it shortly after I
saw the light.)
Here's my insert code:
# Populate the hash
my %user = (
fname => "$c->req->params->{fname}",
lname => "$c->req->params->{lname}",
username => "$c->req->params->{username}",
password => "$c->req->params->{password}",
email => "$c->req->params->{email}",
active => '1' );
# Create the object
my $new_user = MyApp2::Model::DBIC::Users->new(\%user);
# Insert the user
$new_user->insert_or_update;
/dennis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20051231/0c8b02d4/attachment.htm
More information about the Catalyst
mailing list