how to use a max or ceiling in Ruby?
I have a pag开发者_JAVA技巧inator that shows the following for page 1
records 1 through 10
10 being the number of records per page. Thing is for new users they might have under 10 records so showing 10 as the # per page doesn't work
How can I do something like this
if total_record_count is < 10, show total_record_count ELSE show 10 (records per page)
Thanks
Well there's always Enumerable#min
:
<%= [posts.count, 10].min %>
精彩评论