dimanche 28 septembre 2014

Ordering posts by date created and then highest voted using Thumbs Up


Vote count:

0




I'm trying to group posts (called Topic) by date first, so that the newest comes on top. After that, I want to display the highest voted for that date on the top.


Here's my controller: topics_controller.rb



@topics = Topic.tally.group(created_at: :desc).order('vote_count')


But my output comes out like this,


index.html.erb


I want 28th post, 27th post and then 26th post to be displayed. What am I doing wrong here?



asked 41 secs ago







Ordering posts by date created and then highest voted using Thumbs Up

Aucun commentaire:

Enregistrer un commentaire