As far as documentation, I've been working from the introduction to the DBIx class at http://www.annocpan.org/~MSTROUT/DBIx-Class-0.06999_02/lib/DBIx/Class/Manual/Intro.pod , as well as referencing a great thread from the list archives (http://www.gossamer-threads.com/lists/catalyst/users/7463?search_string=schema%20loader ) where there's a detailed example of what files go in what Catalyst folders (Model vs. Schema, etc).

I put the following command on my page (dbixdemo.pm), and it rendered fine in the browser:
              my $sc
hema = $c->model("SLogDB");
When I tried to follow it up with
              my $attempt = $schema->resultset('tblsmaps')->find(14);
I got the error

      Caught exception in vieSEB::Controller::dbixdemo->default "Can't locate object method "resultset" via package "vieSEB::Model::SLogDB"

Maybe I have the wrong plugin installed or something. Jess, in your example, what should Foo be? A table in the database? A query you set up somewhere else?

Thanks again,

Sarah




On 6/16/06, Jess Robinson <[EMAIL PROTECTED] > wrote:


On Thu, 15 Jun 2006, Kevin Old wrote:

> On 6/15/06, Sarah Berry < [EMAIL PROTECTED]> wrote:
>> I'm trying to learn how to use the database plugins, specifically DBIx. I
>> set up my schemas to load from an existing database (hopefully), and now I
>> want to test it out to see if I did that right. So I put the following lines
>> into a page called dbixdemo.pm, in the "default" function:
>>
>>         my $schema = VieSEB::Schema::SLogDB->new();
>>         my $crazy_attempt =
>> $schema->resultset('SLogDB')->find(14);
>
> Hi Sarah,
>
> Make your calls in Controllers like this:
>
> $c->model("VieSEB::Schema::SLogDB")->new();
> $c->model("VieSEB::Schema::SLogDB")->search();
> $c->model("VieSEB::Schema::SLogDB")->find();
>

Or, more sanely:

my $schema = $c->model("SLogDB");
my $attempt = $schema->resultset('Foo')->find(14);

or even:

my $attempt = $c->model('SLogDB::Foo')->find(14);

You shouldnt need to call ->new, as Catalyst does that for you, and stores
the result, which you can retrieve using $c->model.

Are there not examples in the Catalyst::Model::DBIC::Schema pod?

Jess


_______________________________________________
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/

_______________________________________________
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/

Reply via email to