From: Alexander Hartmaier Date: Thu, 11 Aug 2011 08:58:45 +0000 (+0200) Subject: fetch a model instance on every request instead of using stored_result_source for... X-Git-Tag: 2.004001~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Controller-DBIC-API.git;a=commitdiff_plain;h=5a3fd922042f9f0c8281a60014244a70e526f085 fetch a model instance on every request instead of using stored_result_source for ACCEPT_CONTEXT/Catalyst::Component::InstancePerContext compatibility --- diff --git a/lib/Catalyst/Controller/DBIC/API.pm b/lib/Catalyst/Controller/DBIC/API.pm index aa75619..5be5751 100644 --- a/lib/Catalyst/Controller/DBIC/API.pm +++ b/lib/Catalyst/Controller/DBIC/API.pm @@ -191,16 +191,19 @@ sub deserialize :Chained('setup') :CaptureArgs(0) :PathPart('') :ActionClass('De =method_protected generate_rs -generate_rs is used by inflate_request to generate the resultset stored in the current request. It receives $c as its only argument. And by default it merely returns the resultset from the stored_result_source on the controller. Override this method if you need to manipulate the default implementation of getting the resultset from the controller. +generate_rs is used by inflate_request to get a resultset for the current +request. It receives $c as its only argument. +By default it returns a resultset of the controller's class. +Override this method if you need to manipulate the default implementation of +getting a resultset. =cut sub generate_rs { - #my ($self, $c) = @_; - my ($self) = @_; + my ($self, $c) = @_; - return $self->stored_result_source->resultset; + return $c->model($self->class); } =method_protected inflate_request