Tim Shaffer wrote in post #975786: > > > Here is an example of code that would fit your needs: > > records = [] > Category.all.each do |category| > records << category.clients.first > end
Yes, that is what I ended up doing, more or less. What I did was this: > cset = [] > Client.select("DISTINCT(client_category)").each do |c| > cset << Client.find_by_client_category(c.client_category) > end However, since I was in the console when I ran into this situation I was hoping that there existed a more direct way of accomplishing it ( in other words on a single line ) and that I was simply ignorant of the method. Thus my question. Thank all of you for your comments and help. -- Posted via http://www.ruby-forum.com/. -- 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@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.