Permalink
Browse files

Added validator_profile accessor to store current profile

  • Loading branch information...
1 parent d80e003 commit 9794cee26e37f489e745036b51cc360887cd837b typester committed Jul 23, 2006
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/Catalyst/Plugin/FormValidator/Simple/Auto.pm
@@ -1,13 +1,16 @@
package Catalyst::Plugin::FormValidator::Simple::Auto;
use strict;
use warnings;
+use base qw/Class::Accessor::Fast/;
use Catalyst::Exception;
use UNIVERSAL::isa;
use YAML;
our $VERSION = '0.06';
+__PACKAGE__->mk_accessors(qw/validator_profile/);
+
=head1 NAME
Catalyst::Plugin::FormValidator::Simple::Auto - Smart validation with FormValidator::Simple
@@ -99,6 +102,7 @@ sub prepare {
my $c = shift->NEXT::prepare(@_);
if ( my $profile = $c->config->{validator}{profiles}{ $c->action->reverse } ) {
+ $c->validator_profile( $c->action->reverse );
$c->form(%$profile);
}
@@ -114,6 +118,7 @@ sub forward {
my $action = $c->dispatcher->_invoke_as_path($c, @_);
if ( my $profile = $c->config->{validator}{profiles}{ $action } ) {
+ $c->validator_profile($action);
$c->form(%$profile);
}

0 comments on commit 9794cee

Please sign in to comment.