vrfs-774: added upper bound to the per_page param

This commit is contained in:
Jonathan Kolyer 2013-11-23 00:04:07 -06:00
parent c0c6879833
commit 5b1ea983fa
1 changed files with 2 additions and 2 deletions

View File

@ -150,7 +150,7 @@ module JamRuby
end
rel = rel.select(sel_str)
perpage = params[:per_page] || M_PER_PAGE
perpage = [params[:per_page] || M_PER_PAGE, 100].min
page = [params[:page].to_i, 1].max
rel = rel.paginate(:page => page, :per_page => perpage)
rel.includes([:instruments, :followings, :friends])
@ -256,7 +256,7 @@ module JamRuby
.order('created_at DESC')
.limit(max_count)
if 0 < rel.count
yield rel
yield(rel)
end
end
end