It fails when it's in your myDB dir because DBIC tries to load it as a
'table' class I believe (may be wrong)
# try, with a full package name
__PACKAGE__->resultset_class('MyApp::ResultSet::TestRes');
then call your resultset the same you would have done earlier. this wont
affect the name of your resultset, just the class it uses..
On 5/18/07, John Goulah <[EMAIL PROTECTED]> wrote:
On 5/18/07, John Goulah <[EMAIL PROTECTED]> wrote:
>
> On 5/18/07, Guillermo Roditi <[EMAIL PROTECTED]> wrote:
> >
> > Correction, you want to add it to the ResultSet class, not the result
> > class! and yes there's a way.
> >
> >
http://search.cpan.org/~blblack/DBIx-Class/lib/DBIx/Class/Manual/Cookbook.pod#Predefined_searches
> >
> >
<http://search.cpan.org/%7Eblblack/DBIx-Class/lib/DBIx/Class/Manual/Cookbook.pod#Predefined_searches>
> >
> >
http://search.cpan.org/~jrobinson/DBIx-Class-0.07999_02/lib/DBIx/Class/Storage/DBI.pm
> >
> >
<http://search.cpan.org/%7Ejrobinson/DBIx-Class-0.07999_02/lib/DBIx/Class/Storage/DBI.pm>
> >
> > $self->result_source->schema->storage
>
>
>
>
>
> That makes sense, but for some reason when I follow the example it wont
> let me start my server. I create a directory under myDB called ResultSet,
> and put an object call TestRes.pm in there which contains:
>
> package myDB::ResultSet::TestRes;
>
> use strict;
> use warnings;
> use base 'DBIx::Class::ResultSet';
>
> 1;
>
>
> and when I try to start the catalyst server I get:
>
> Couldn't instantiate component "MyApp::Model::myDB", "Cannot load schema
> class 'myDB': Can't locate object method "source_name" via package
> "myDB::ResultSet::TestRes" at
> /usr/local/share/perl/5.8.8/DBIx/Class/Schema.pm line 280.
> Compilation failed in require at
> /usr/local/share/perl/5.8.8/Catalyst/Model/DBIC/Schema.pm line 272.
>
> From searching the web it says to check the other classes mentioned in
> the error, all of which compile fine, and if I move the ResultSet folder out
> of my app, things are fine. Pulling at straws, I defined a method called
> source_name, which then just leads the compiler to throw another error.
>
>
> Any Ideas?
>
> Thanks!
> John
Also, if I move the ResultSet folder out of myDB and put it in lib, I am
able to start the server, but I get the error:
"DBIx::Class::Schema::__ANON__(): Can't find source for TestRes ......
I do have this in my table model schema class:
__PACKAGE__->resultset_class('ResultSet::TestRes');
And in my controller code I'm trying to call it like:
$c->model->resultset('TestRes')->get_test_result();
which is the line the error points to.
Thanks,
John
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive:
http://www.mail-archive.com/[email protected]/
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/