On 28/01/07, Guillermo Roditi <[EMAIL PROTECTED]> wrote:
FIXED IT!!! take out the does '...' line and replace it with this: override parameter_hashref => sub{ my $self = shift; my $args = super(); $args->{password} = delete $args->{new_password}; delete $args->{confirm_new_password}; return $args; }; here's my class: package Prefab::Model::Action::CreateUser; use strict; use warnings; use Reaction::Class; use aliased 'Reaction::InterfaceModel::Action::DBIC::ActionReflector'; extends qw( Reaction::InterfaceModel::Action::User::SetPassword Reaction::InterfaceModel::Action::DBIC::ResultSet::Create ); my $r = ActionReflector->new; $r->reflect_attrs('Prefab::Schema::User' => __PACKAGE__, qw/id username created_d role_list/); override parameter_hashref => sub{ my $self = shift; my $args = super(); $args->{password} = delete $args->{new_password}; delete $args->{confirm_new_password}; return $args; }; 1; If you want to reflect fields like i did then add this method to action reflector: implements reflect_attrs => as { my ($self, $from_class, $to_class, @attrs) = @_; foreach my $attr_name (@attrs) { $self->reflect_attribute_to($from_class, $from_class->meta->get_attribute($attr_name), $to_class); } };
Cool, I like that reflect_attrs method, I'm already using it. I have tried your aproach before. You can't delete the 'new_password' and 'confirm_new_password' or the confirm_password is not checked against 'new_password'. You have to live with the warnings in the error log. But it doesn't work for me either. The problem is that Reaction::InterfaceModel::Action::User::SetPassword and Reaction::InterfaceModel::Action::DBIC::Role::CheckUniques both override 'error_for_attribute' and 'can_apply'. So if you have unique constraints in your schema they don't get evaluated if your class extends from User::SetPassword before ResultSet::Create or if you reverse the order then your confirm password is not checked. I tried to change the methods from override to augment and the super() call to an inner() call but i got following error: Moose::Role cannot support 'augment' at /usr/local/share/perl/5.8.7/Moose/Role.pm line 138 So i don't know how to fix this. -- Jonas
_______________________________________________ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/