variable using problem

I have an array A = ['XXX','YYY','ZZZ','RRR','WWW']
For each element of array I must execute a query on my database.
I don't want write this code:

A.each {
  >elem>
  case elem
  when 'XXX' do Model.find(:all,:select => 'COD',:group =>
'COD',:include => :table).map{|el| el.table.XXX}.sort
   .
   .
   .
  end
}

I'd like this:

A.each {
  >elem>
  Model.find(:all,:select => 'COD',:group => 'COD',:include
=> :table).map{|el| el.table.elem}.sort
}

But there's a problem in this code. Can you help me? Can I write that?
Thank you very much

I'd like this:

A.each {
>elem>
Model.find(:all,:select => 'COD',:group => 'COD',:include
=> :table).map{|el| el.table.elem}.sort

}

For a given attribute, some_record['foo'] gets you the attribute
value. You might also be interested in the send method.

Fred