I need a small sample of representative test data from a live data set such 
that each row belongs to a different category and all active categories are 
represented. Period.

Now that we know your requirements, we can recommend a way to do it. 
Selecting distinct is not the solution to the requirements you posed.

Here is an example of code that would fit your needs:

records = []
Category.all.each do |category| 
  records << category.clients.first
end

-- 
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.

Reply via email to