0
如何将limit
添加到此范围?急于加载限制?
scope :with_comments, include: {comments: :user}
我使用的是这样的:
Event.with_comments.find(params[:id])
如何将limit
添加到此范围?急于加载限制?
scope :with_comments, include: {comments: :user}
我使用的是这样的:
Event.with_comments.find(params[:id])
scope :with_comments, include(comments: :user).limit(5)
default_scope includes(:comments :user).limit(5)
添加到默认范围
Event.find(params[:id])
这可能吗? – Zeck
检查这个问题,你会得到你的答案http://stackoverflow.com/questions/9808674/rails-eager-load-and-limit – SSP