X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Controller-DBIC-API.git;a=blobdiff_plain;f=lib%2FCatalyst%2FController%2FDBIC%2FAPI.pm;h=bfd50242d957792d97cefe2ba513bbc78497a56c;hp=0331ad9a66a772106cfe9062d022a3781470df1a;hb=7821bdec3826d11fe878d13859c15d7f2c5b0cfa;hpb=d6993542dd4ef970bd0ab87258306ed970cb98c8 diff --git a/lib/Catalyst/Controller/DBIC/API.pm b/lib/Catalyst/Controller/DBIC/API.pm index 0331ad9..bfd5024 100644 --- a/lib/Catalyst/Controller/DBIC/API.pm +++ b/lib/Catalyst/Controller/DBIC/API.pm @@ -180,7 +180,9 @@ generate_rs is used by inflate_request to generate the resultset stored in the c sub generate_rs { - my ($self, $c) = @_; + #my ($self, $c) = @_; + my ($self) = @_; + return $self->stored_result_source->resultset; } @@ -461,7 +463,8 @@ row_format_output is called each row of the inflated output generated from the s sub row_format_output { - my ($self, $c, $row) = @_; + #my ($self, $c, $row) = @_; + my ($self, undef, $row) = @_; return $row; # passthrough by default } @@ -791,7 +794,8 @@ insert_object_from_params sets the columns for the object, then calls ->insert sub insert_object_from_params { - my ($self, $c, $object, $params) = @_; + #my ($self, $c, $object, $params) = @_; + my ($self, undef, $object, $params) = @_; my %rels; while (my ($k, $v) = each %{ $params }) { @@ -831,7 +835,8 @@ Performs the actual ->delete on the object sub delete_object { - my ($self, $c, $object) = @_; + #my ($self, $c, $object) = @_; + my ($self, undef, $object) = @_; $object->delete; } @@ -887,7 +892,8 @@ This only executes if L if set and if there are any objects to a sub each_object_inflate { - my ($self, $c, $object) = @_; + #my ($self, $c, $object) = @_; + my ($self, undef, $object) = @_; return { $object->get_columns }; } @@ -910,7 +916,14 @@ push_error stores an error message into the stash to be later retrieved by Lstash->{_dbic_crud_errors}}, $params->{message} || 'unknown error' ); + my $error = 'unknown error'; + if (exists $params->{message}) { + $error = $params->{message}; + # remove newline from die "error message\n" which is required to not + # have the filename and line number in the error text + $error =~ s/\n$//; + } + push( @{$c->stash->{_dbic_crud_errors}}, $error); } =method_protected get_errors