如何按评级排序我的唱片部分?
我有一个场地表,其中每个场地都有很多评论,并且每个评论都有一个评级 (1-5),我的场地索引页面当前将所有场地按照创建顺序显示为部分场地,最旧的位于顶部,我该如何更改这是为了在顶部显示平均评分最高的场馆吗?
我的场地控制器索引目前如下所示:
def index
if
@venues = Venue.with_type(params[:venuetypes]).with_area(params[:areas])
else
@venues = Venue.all
end
end
感谢您的帮助!
I have a table of venues where each has many reviews and each review has a rating (1-5), my venue index page currently shows all the venues as partials in the order they were created with the oldest at the top how can I change this to display the venues with the highest average rating at the top?
My venues controller index currently looks like this:
def index
if
@venues = Venue.with_type(params[:venuetypes]).with_area(params[:areas])
else
@venues = Venue.all
end
end
Thanks for any help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 Rails 3?这是一个起点。
Using Rails 3? Here's a starting point.