Actually only find methods which have been defined with the 'command' syntax..
t0m [Sun, 26 Apr 2009 21:59:56 +0000 (22:59 +0100)]
lib/CatalystX/ModelToControllerReflector.pm

index 686853a..8651d3b 100644 (file)
@@ -1,5 +1,6 @@
 package CatalystX::ModelToControllerReflector;
 use Moose::Role;
+use Moose::Util qw/does_role/;
 use namespace::autoclean;
 
 with 'CatalystX::DynamicComponent' => {
@@ -33,9 +34,8 @@ sub _reflect_model_to_controller {
 
     my %controller_methods;
     my $model_methods = $model->meta->get_method_map;
-    delete $model_methods->{new}; # FIXME..
-    delete $model_methods->{meta};
     foreach my $method_name (keys %$model_methods) {
+            next unless does_role($model_methods->{$method_name}, 'CatalystX::ControllerGeneratingModel::DispatchableMethod');
             # Note need to pass model name, as the method actually comes from
             # the underlying model class, not the Catalyst shim class we autogenerated.
             $controller_methods{$method_name} = $app->generate_reflected_controller_action_method($suffix, $model_methods->{$method_name})