I have a model_one that :has_many model_two-s, I would like to find the ten model_one's that have the most model_two's. What is the best way to do this?
Model_One.find(:all, :limit => 10, :include => :model_two, :order =>"themost of model_two desc") or inorder for me to do this effeciently (I have thousands of model_two-s) would i need to add a column to model_one, to keep track of the number of model_two-s that model_one owns. Or is there some index i can use? What is the best practice in this situation? -- 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 -~----------~----~----~----~------~----~------~--~---