KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a model named Song . I also have a model named Listen . A Listen belongs_to :song , and a song :has_many listens (can be listen to many times). In my model I want to define a method self.top which should return the top 5 songs listened to the most. How can I achieve that using the has_many relation? I'm using Rails 3.1. Thanks!
Tags (comma-separated)
Save Edits
Cancel