X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FMaypole%2FModel%2FBase.pm;h=6e60aea7f9c3f4505b93263eaa31fcef4dc240d2;hb=f80621477b1dfe74dc1a18d5453e3f9225022a78;hp=9d673c61858c69061c5e24ab30c3c4be2a0c3849;hpb=344d21e842093ff5f863923abe65377999c12c8a;p=maypole.git diff --git a/lib/Maypole/Model/Base.pm b/lib/Maypole/Model/Base.pm index 9d673c6..6e60aea 100644 --- a/lib/Maypole/Model/Base.pm +++ b/lib/Maypole/Model/Base.pm @@ -8,9 +8,17 @@ sub edit :Exported { } sub process { my ($class, $r) = @_; - $r->template( my $method = $r->action ); - $r->objects([ $class->retrieve(shift @{$r->{args}}) ]); - $class->$method($r); + my $method = $r->action; + return if $r->{template}; # Authentication has set this, we're done. + + $r->{template} = $method; + $r->objects([]); + my $obj = $class->retrieve( $r->{args}->[0] ); + if ($obj) { + $r->objects([ $obj ]); + shift @{$r->{args}}; + } + $class->$method($r, $obj, @{$r->{args}}); } sub display_columns { @@ -117,7 +125,7 @@ Return a hash mapping column names with human-readable equivalents. sub column_names { my $class = shift; map { my $col = $_; - $col =~ s/_+(\w)?/ \U\1/g; + $col =~ s/_+(\w)?/ \U$1/g; $_ => ucfirst $col } $class->columns } =head2 description