See the Mojo::Pg example blog app
<https://github.com/kraih/mojo-pg/blob/master/examples/blog/lib/Blog.pm#L14>
.

On Thu, Mar 30, 2017 at 2:17 AM, james foss <[email protected]> wrote:

> Thanks again, that really helps.
>
> So is the following correct to be able to use my db connection in my
> controllers and models.  Will this work correctly with preforking?
>
> has schema {
>     return App::Schema::connect(...);
> }
>
> $self->helper(db => sub { $self->app->schema });
> $self->helper (model => sub { state $model = App::Model::Name->new(db =>
> shift->db) });
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to