}
}
- my $this_class_params = { map { $_ => $r->{params}{$_} } $class->columns };
- delete $this_class_params->{route_id};
+
+ my $this_class_params = {};
+ foreach my $param ( $class->columns ) {
+ next if ($param eq $class->columns('Primary'));
+ my $value = $r->params->{$param};
+ next unless (defined $value);
+ $this_class_params->{$param} = ( $value eq '' ) ? undef : $value;
+ }
# update or make other related (must_have, might_have, has_many etc )
unless ($errors) {
sub _do_create {
my ($class,$r) = @_;
my $errors;
- my $this_class_params = { map { $_ => $r->{params}{$_} } $class->columns };
+
+ my $this_class_params = {};
+ foreach my $param ( $class->columns ) {
+ next if ($param eq $class->columns('Primary'));
+ my $value = $r->params->{$param};
+ next unless (defined $value);
+ $this_class_params->{$param} = ( $value eq '' ) ? undef : $value;
+ }
+
my $obj;
my $dfv_results = Data::FormValidator->check($r->{params}, $class->dfv_profile);