[Catalyst] Accessing $c from Model

Juan Miguel Paredes juan.paredes at gmail.com
Thu Feb 1 15:30:50 GMT 2007


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 => 'context');
>
> then
>
> my $new = bless ...
>
> $new->schema(bless(...)); # same trick on the schema
>
> $new->schema->context($c);
>
> then in the DBIC code
>
> $self->result_source->schema->context;
>
> make more sense?
>

Indeed, your suggestion worked fine, thanks a lot!  Just had to add
DBIx::Class::AccessorGroup to the schema class

Regards,

Juan.



More information about the Catalyst mailing list