Accessing information stored in a database on Heroku
I am working on an open source application for running soundcloud remix competitions. My app is running here, http://plpcomp11.herokuapp.com/
It has a voting system which automatically shows the top three entries, but only the top three and doesn't display the number of votes for each entry.
I want to access from the database, how many votes have been cast for each entry. Any ideas how to do this???
The database files are here on github.开发者_如何学C
https://github.com/soundcloud/soundcloud-remix/tree/master/db
You mean, something like this?
in controller:
@remixes = Remix.all(:order => 'votes_count DESC', :limit => 3)
in view:
@remixes.each do |remix|
"#{remix.track_id} has #{remix.votes_count} votes"
end
精彩评论