[Catalyst] Problems using DBIx with update_or_create()
Alex Kavanagh
alex at tinwood.homelinux.org
Sun Feb 26 14:27:28 CET 2006
At Sat, 25 Feb 2006 10:16:04 -0700,
Nathan Kurz wrote:
>
> On Fri, Feb 24, 2006 at 07:01:07PM +0000, Matt S Trout wrote:
> > On Fri, Feb 24, 2006 at 10:22:11AM -0700, Nathan Kurz wrote:
> > > I'm having a small problem using Catalyst and the
> > > DBIx method update_or_create(). My code looks like this:
> > >
> > > my $user = Notate::Model::DB::User->update_or_create({
> > > email => $email,
> > > password => md5_hex($password),
> > > });
> > >
> > > When I run it, I get an exception that the object method
> > > 'update_or_create' could not be found. When I use 'create()',
> > > everything works as expected. I think this is just a small problem
> > > with ResultSetProxy.pm missing some functions. Or am I doing
> > > something fundamentally wrong?
> >
> > No, that's almost certainly the case. ResultSetProxy is designed to support
> > old usage until people convert over to the Schema approach. If you're still
> > using DB.pm you should be able to get at the schema object my calling
> >
> > One::Of::My::Classes->schema_instance
>
> Thanks! So for a new usage, I should be using DBIC::Schema instead of
> DBIC?
Yes, I think so. It is the way that DBIx::Class is going.
> I hadn't known I was using an outdated approach, and certainly
> did not intend to. I went through the tutorial in the manual
> (supplemented with looking at the Parley as an example), and used what
> it gave me as a place to start from. From what I can tell, the
> tutorial (otherwise excellent) makes no mention of the new usage.
This framework is changing so rapidly that the docs don't keep up.
The only way I know what is going on is to keep an eye on this mailing
list.
>
> Do I still want to be using Authentication::Store::DBIC, or is there a
> corresponding Authentication::Store::DBIC::Schema that should be used
> instead? Or is DBIC:Schema compatible with DBIC once it's set up?
C::P::Authentication::Store::DBIC is compatible with Class::DBI, plain
DBIx::Class and DBIx::Class::Schema but only in the svn Trunk. I
don't think that it has made it into a release yet (i.e. its 0.04 on
CPAN and 0.05 on svn trunk and only 0.05 has the DBIx::Class::Schema
support).
>
> And is there a canonical Catalyst DBIC::Schema example I should
> follow?
Not that I know of. Anyone?
Cheers
Alex.
>
> Thanks!
>
> Nathan Kurz
> nate at verse.com
>
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
More information about the Catalyst
mailing list