rewrite IM predicates
[catagits/Reaction.git] / lib / Reaction / UI / ViewPort / Field.pm
index 1ddbee4..1ccc99c 100644 (file)
@@ -14,8 +14,6 @@ class Field is 'Reaction::UI::ViewPort', which {
   has model     => (is => 'ro', isa => Object,             required => 1);
   has attribute => (is => 'ro', isa => ParameterAttribute, required => 1);
 
-  implements adopt_value => as {};
-
   implements _build_name => as { shift->attribute->name };
 
   implements _build_label => as {
@@ -30,11 +28,11 @@ class Field is 'Reaction::UI::ViewPort', which {
 
   implements _model_has_value => as {
     my ($self) = @_;
-    my $predicate = $self->attribute->predicate;
+    my $predicate = $self->attribute->get_predicate_method;
 
     if (!$predicate || $self->model->$predicate
-        || ($self->attribute->is_lazy
-            && !$self->attribute->is_lazy_fail)
+        #|| ($self->attribute->is_lazy
+        #    && !$self->attribute->is_lazy_fail)
       ) {
       # either model attribute has a value now or can build it
       return 1;
@@ -48,7 +46,7 @@ class Field is 'Reaction::UI::ViewPort', which {
     # the model and DBIC can have nullable fields and DBIC doesn't
     # have a way to tell us that doesn't force value inflation (extra
     # SELECTs for belongs_to) so basically we're screwed.
-    return ($self->_model_has_value && defined($self->value)
+    return ($self->_model_has_value && defined($self->_build_value)
               ? $self->_value_string_from_value
               : $self->_empty_string_value);
   };