Topic: Any thoughts ?

xml.chart do
  xaxis = []
  Contact.find(:all).each do |c|
    xaxis << c.first_name
  end
  xaxis = xaxis.uniq
  xaxis.each do |x|
  xml.set :value => Contact.sum(:age, :conditions => {:first_name => x}), :label => x
  end
end

Re: Any thoughts ?

Hmm something like this ?

xml.chart do
  xaxis = Contact.find(:all, :select => 'DISTINCT(first_name)').map {|c| c.first_name}
  xaxis.each do |x|
  xml.set :value => Contact.sum(:age, :conditions => {:first_name => x}), :label => x
  end
end

Re: Any thoughts ?

Brilliant
Thanks a lot