[Catalyst] Accessing $c from Model
Scott Thomson
smoothhound at gmail.com
Tue Feb 27 11:25:57 GMT 2007
Hi,
This is exactly what I want to do, however I can't seem to get my head round
how to implement this solution, I've tried various incarnations but I don't
seem to be getting anywhere.
Annotations below, thanks for patience.
Scott
On 2/1/07, Juan Miguel Paredes <juan.paredes at gmail.com> wrote:
>
> On 2/1/07, Matt S Trout <dbix-class at trout.me.uk> wrote:
> >
> > package MyApp::DataStore; # or whatever this is called
> >
> > use base qw/DBIx::Class::Schema/;
> >
> > __PACKAGE__->mk_group_accessors(simple =3D> 'context');
I get this bit, (also add DBIx::Class::AccessorGroup to the base class list)
> then
> >
> > my $new =3D bless ...
> >
> > $new->schema(bless(...)); # same trick on the schema
> >
> > $new->schema->context($c);
Is the above in the same file? what should replace the ellipsis
> then in the DBIC code
> >
> > $self->result_source->schema->context;
> >
> > make more sense?
> >
Where exactly is the DBIC code? MyApp::Model::DataStore?
Indeed, your suggestion worked fine, thanks a lot! Just had to add
> DBIx::Class::AccessorGroup to the schema class
>
> Regards,
>
> Juan.
>
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070227/573e0=
0e1/attachment.htm
More information about the Catalyst
mailing list