On 7/13/06, Ian VanDerPoel <[EMAIL PROTECTED]> wrote:
> Kim,
>
> Sorry Kim, I have specified this incorrectly. I was not thinking straight. 
> The has_many has > >the order_by clause.

I think you were thinking straight. :) In Maypole 2.11 which is really
close to coming out, it is perfectly fine to say
BeerDB::Beer->has_a('brewery', BeerDB::Brewery, 'order_by' => 'name
Desc');  That is you can put arbitrary arguments in a relationship
meta data that AsForm will watch out for and respect

These just get passed on to the to_field call which takes options.  I
will work on my demo more tomorrow. However here is how it should work
(and i think it actually does at this point) :

BeerDB::Beer->to_field('brewery','select', {order_by => 'name ASC',
where => "location = 'Germany'");

The select has been rewritten to  do a search rather than a retrieve
all and display thus you can specify lots of options you could not
before including constraints and limits.

You can put these in the has_a declaration if you want:
"no_select"  -- dont make a select box out of this has_a relationship.
"order_by" --
"where" -- arbitrary where code
"constraint" -- column constraints on rows you pic {key => val}


Ill add some demos to the fancy example in SVN  tomorrow and fix the
docs and then post back.
  Another easy way to do what you want in 2.11 kim is to say:
$breweries = [Brewery->retrieve_all_sorted_by(''name')];
BeerDB::Beer->to_field(brewery, 'select' , {items => $breweries});

If you pass the items option, it makes a select box out of those.

cheers


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Maypole-users mailing list
Maypole-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/maypole-users

Reply via email to