in reply to Re: Methods in template toolkit
in thread Methods in template toolkit
I disagree (partially), what the OP is doing here is just grabbing a related object, which is not much different from grabbing a value from a local field. I do agree that the code to fetch from the resultset and such should probably not be in the View, but I would probably put this into the Model rather then the Controller, something like this in his Variant class would work.
then the OP could improve on it and add error handling or additional validation as well.sub get_related_measurement_thingy { my ($self, $type_measurement) = @_; $self->variant_measurements_rs->find( $self->id, $type_measurement->measurement_id ); # the template should probably call ->value though }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Methods in template toolkit
by dariusj (Sexton) on Dec 06, 2007 at 18:35 UTC |