fix up code to 404
[catagits/catbook-code.git] / lib / LolCatalyst / Lite / Controller / Translate.pm
index 749b3ac..b9f7eb1 100644 (file)
@@ -37,6 +37,9 @@ sub view :Chained('object') :PathPart('') :Args(0) {
 sub translate_to :Chained('object') :PathPart('to') :Args(1) {
   my ($self, $c, $to) = @_;
   my $object = $c->stash->{object};
+  unless ($object->can_translate_to($to)) {
+    $c->detach('/error_404');
+  }
   $c->stash(
     result => $object->translated_to($to)
   );