Colin A. Bartlett on 30 Mar 2007 08:42:24 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

RE: [PhillyOnRails] XML Builder question


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

-Colin

_______________________________________________
To unsubscribe or change your settings, visit:
http://lists.phillyonrails.org/mailman/listinfo/talk