Saturday, 7 September 2013

Sorting Based on a has_many relationship

Sorting Based on a has_many relationship

Project is located at
http://code-dojo.herokuapp.com/
and
https://github.com/TylerSangster/Code-Dojo
I have a resource review site with the following models.
class Resource < ActiveRecord::Base
has_many :reviews
class Review < ActiveRecord::Base
belongs_to :resource
I have added resource sorting by name, created at, and cost. I would also
like to sort by the highest reviewed resource.
How can I create a sort by review.score ?

No comments:

Post a Comment