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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---