[Jifty-commit] r5565 - in jifty/trunk: lib/Jifty/Action/Record t/TestApp/lib/TestApp/Action
Jifty commits
jifty-commit at lists.jifty.org
Mon Jul 21 13:46:36 EDT 2008
Author: trs
Date: Mon Jul 21 13:46:36 2008
New Revision: 5565
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Action/Record/Create.pm
jifty/trunk/lib/Jifty/Action/Record/Update.pm
jifty/trunk/t/TestApp/lib/TestApp/Action/NewSomething.pm
Log:
r37676 at zot: tom | 2008-07-21 13:44:19 -0400
We do a lot of work in Jifty::Param::Schema::merge_params() to make sure merging action arguments DTRT, so we really need to use it in Jifty::Action::Record::{Update,Create}.
In Create, we don't want to ignore values that aren't columns because the create method in the model might want to handle them. We should pass them through, and if an action uses non-column arguments that create doesn't handle, it needs to delete the argument after using it.
Modified: jifty/trunk/lib/Jifty/Action/Record/Create.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Action/Record/Create.pm (original)
+++ jifty/trunk/lib/Jifty/Action/Record/Create.pm Mon Jul 21 13:46:36 2008
@@ -41,11 +41,16 @@
$args->{$arg}{default_value} = $column->default;
}
}
-
- return Hash::Merge::merge(
- $args,
- (eval { $self->PARAMS } || {}),
- );
+
+ if ( $self->can('PARAMS') ) {
+ use Jifty::Param::Schema;
+ return Jifty::Param::Schema::merge_params(
+ $args, ($self->PARAMS || {})
+ );
+ }
+ else {
+ return $args;
+ }
}
=head2 take_action
Modified: jifty/trunk/lib/Jifty/Action/Record/Update.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Action/Record/Update.pm (original)
+++ jifty/trunk/lib/Jifty/Action/Record/Update.pm Mon Jul 21 13:46:36 2008
@@ -19,7 +19,6 @@
use base qw/Jifty::Action::Record/;
use Scalar::Util qw/ blessed /;
-use Hash::Merge;
=head1 METHODS
@@ -51,12 +50,16 @@
$arguments->{$pk}{'render_as'} = 'Unrendered';
# primary key fields should always be hidden fields
}
-
- # XXX Should this be moved up into Jifty::Action::Record?
- return Hash::Merge::merge(
- $arguments,
- (eval { $self->PARAMS } || {}),
- );
+
+ if ( $self->can('PARAMS') ) {
+ use Jifty::Param::Schema;
+ return Jifty::Param::Schema::merge_params(
+ $arguments, ($self->PARAMS || {})
+ );
+ }
+ else {
+ return $arguments;
+ }
}
=head2 validate_arguments
Modified: jifty/trunk/t/TestApp/lib/TestApp/Action/NewSomething.pm
==============================================================================
--- jifty/trunk/t/TestApp/lib/TestApp/Action/NewSomething.pm (original)
+++ jifty/trunk/t/TestApp/lib/TestApp/Action/NewSomething.pm Mon Jul 21 13:46:36 2008
@@ -27,6 +27,9 @@
$self->argument_value( test3 => $test3 );
}
+ # Unset direction because our create for Something doesn't handle it.
+ $self->argument_value( direction => undef );
+
$self->argument_value( test3 => $test3 . $self->argument_value('append') )
if defined $self->argument_value('append');
More information about the Jifty-commit
mailing list