Catalyst::TraitFor::Model::DBIC::Schema::PerRequestSchema - Clone the schema with attributes for each requests
__PACKAGE__->config({ traits => ['PerRequestSchema'], }); sub per_request_schema_attributes { my ($self, $c) = @_; return (restricting_object => $c->user->obj); } ### OR ### sub per_request_schema { my ($self, $c) = @_; return $self->schema->schema_method($c->user->obj) }
Clones the schema for each new request with the attributes retrieved from your per_request_schema_attributes method, which you must implement. This method is passed the context.
per_request_schema_attributes
Alternatively, you could also override the per_request_schema method if you need access to the schema clone and/or need to separate out the Model/Schema methods. (See examples above and the defaults in the code.)
per_request_schema
Catalyst::Model::DBIC::Schema, DBIx::Class::Schema
See "AUTHOR" in Catalyst::Model::DBIC::Schema and "CONTRIBUTORS" in Catalyst::Model::DBIC::Schema.
See "COPYRIGHT" in Catalyst::Model::DBIC::Schema.
This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
To install Catalyst::Model::DBIC::Schema, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Model::DBIC::Schema
CPAN shell
perl -MCPAN -e shell install Catalyst::Model::DBIC::Schema
For more information on module installation, please visit the detailed CPAN module installation guide.