Subject: | Using invalid column on display_from causes silent failure |
Recently, I had the devel of a time finding this problem. Most of my
tables have a "title" column. However, one has a "class_name" column. I
accidentally used "title" as a display_from argument to valid_values,
which caused a very weird and utterly silent failure.
To reproduce, take any model and create an action like this:
param foo =>
valid_values are defer {
my $collection = Metrics::Model::SomeModelCollection->new;
$collection->unlimit;
[{
display_from => 'non_existant_column_name',
value_from => 'id',
collection => $collection,
}];
};
Run the action in administrative mode and the label for "foo" will show
up, but the rest of the form will not appear because an exception is
being thrown at some point, but no error or warning is being logged. I
don't think any kind of check for this needs to be made, but that
exception shouldn't vanish, it should cause at least some amount of
moaning to the log.
I specifically encountered this behavior in the new_item fragment of the
Jifty admin mode for a customized CreateModel action, if that makes any
difference.