开发者

Accessing information stored in a database on Heroku

开发者 https://www.devze.com 2023-04-12 15:54 出处:网络
I am working on an open source application for running soundcloud remix competitions. My app is running here, http://plpcomp11.herokuapp.com/

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
0

精彩评论

暂无评论...
验证码 换一张
取 消