[Maypole] Using model class methods in addnew

Marcus Ramberg marcus@thefeed.no
Wed, 13 Oct 2004 17:20:34 +0200


Hi Peter.

Try classmetadata.name.<method> ?

Marcus

Peter Speltz wrote:

>Is there a maypole way to use methods of an object your creating in the
>"addnew' templated?  If you're in "beerdb/beer/view/1"  you can say:
>
>beer.mymethod to call that method.  
>
>But if your adding a new beer, in addnew you can't say : 
>
>beer.mymethod. There is no object beer yet.  However it would be nice to call
>BeerDB::Beer methods anytime your working with beer.  
>
>Is that funtionality built into maypole?  
>
>If you want more clarification of my problem : 
>I have a model class Customer.pm generated by CDBI::Loader. I added a method to
>it:
>package Namespace::Customer;
>sub types { ('Residential', 'Business' ) }
>
>I want to use this method in the "addnew" template to populate a drop down list
>to choose the customer type.  But i don't seem to have a Customer obj. I could
>make it a driver method and probably say: request.customer_types in the
>template but obviously it'd be it'd be better in the Customer obj.
>
>thanks.
>
>=====
>pjs
>
>
>		
>_______________________________
>Do you Yahoo!?
>Declare Yourself - Register online to vote today!
>http://vote.yahoo.com
>
>_______________________________________________
>maypole mailing list
>maypole@lists.netthink.co.uk
>http://lists.netthink.co.uk/listinfo/maypole
>  
>