>
> So, how can I make my Model class always aware of some specific controller
> state, like the session? It seems silly to pass the session id for every
> method, like this:
>
> $c->model->method1($id, $other, $parameters);
> $c->model->method2($id, $other, $parameters);
> $c->model->method3($id, $other, $parameters);
>
>
This is the correct way.
Is there a good way to ensure that the Model always has access to some
> controller state, without having to pass that state on every method call?
>
> Right now my solution is to use a hook:
>
> $self->app->hook(before_routes => sub {
> my $c = shift;
> $c->model->id($c->session('id')) if $c->session('id');
> });
>
>
This is wrong and a security issue, since it does not work with concurrent
requests and might even end up leaking information to the wrong user.
--
sebastian
--
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.