Trans
6/5/2006 4:34:00 AM
joesb wrote:
> Trans wrote:
> > Trans wrote:
> > > def enter_territory( country, depot, rest )
> > > @ie.select_list( :name, 'criteria.countryId').select(country)
> > > @ie.select_list( :name, 'criteria.depotId').select(depot)
> > > @ie.select_list( :name, 'criteria.lob').select(rest[:lob]) if
> > > rest[:lob]
> > > @ie.select_list( :name,
> > > 'criteria.territoryType').select(rest[:territory]) if rest[:territory]
> > > @ie.select_list( :name, 'criteria.viewType').select(rest[2]) if
> > > rest[:view]
> > > end
> >
> > Sorry, rest[2] should be rest[:view] as well.
> >
> > T.
>
> How does this work? Could you please explain?
>
> Am I right to assume that now you have changed rest to become hash
> table and change the calling syntax to:
>
> enter_territory('USA', 1, :lob => 2, :view => 3)
That's right. The first two parameter are required still, but the rest
can be in any order.
enter_territory('USA', 1, :view => 3, :lob => 2)
(What do the numbers here stand for BTW, or are they just examples?)
Oops, they should also be optional, right? So change the interface
slightly to:
def enter_territory( country, depot, rest={} )
To get a butter understanding try this:
def enter_territory( country, depot, rest={} )
p country
p depot
p rest
end
And then just try a bunch of differnt calls.
HTH,
T.