Toby DiPasquale on 30 Mar 2007 12:02:43 -0000 |
On Fri, Mar 30, 2007 at 04:41:32AM -0400, Colin A. Bartlett wrote: > Mike Zornek Sent: Friday, March 30, 2007 2:17 AM > > > But the bigger issue is that the list of jobs in this town can and will > > change. It is dynamic but I'm too inexperienced with builder on how I > would > > implement a dynamic job list here. In particular I'm really lost as to how > I > > would start a do block with a dynamic method name. > > Something like this perhaps? > > ['policeman', 'fireman'].each do |job| > xml.send(job) do > Person.find(:all).each do |person| > unless person.send("is_#{job}?") xml.send(job, :name => person.name) > end > end > end This is what I would do. Alternatively, you can check out how the ActiveRecord find_by_* methods work under the hood and replicate that trick. -- Toby DiPasquale _______________________________________________ To unsubscribe or change your settings, visit: http://lists.phillyonrails.org/mailman/listinfo/talk
|
|